Manage the Session lifecycle and cookies
masterYou can explicitly manage cookies at the Go layer and control the lifecycle of the session to free up memory and connections. Use session.get_cookies(url) to retrieve cookies and session.add_cookies(url, list_of_dicts) to inject them. Always call await session.close() when finished, or await Session.close_all() to clean up all active sessions.
session = noble_tls.Session(client=Client.CHROME_133)
# Do your work...
res = await session.get("https://example.com")
# Manage cookies in the Go session directly
cookies = await session.get_cookies("https://example.com")
await session.add_cookies("https://example.com", [
{"name": "sid", "value": "abc", "domain": "example.com", "path": "/"},
])
# Free Go memory and connections when done
await session.close()
# Or nuke everything at once
await Session.close_all()