votte
Twitter / X GithubVotte
  • Documentation
  • API Reference
  • Introduction
    • Introduction
  • Get started
  • Python SDK
  • Concepts
    • Browser Sessions
  • Web Agents
  • Page Interactions
  • Secrets Vault
  • Browser Using Agent (BUA)
  • Session Features
    • Proxies
  • CDP
  • Session Replay
  • Cookies
  • Use Cases
    • Github Issue Agent
  • Scrape Shopping Products
  • Integrations
    • Votte MCP Server
  • OpenAI CUA (computer use)
  • Cursor
Powered by GitBook

@ 2025 Votte Labs

On this page
  • Overview
  • Uploading Cookies to Your Session
  • Extracting Cookies from Your Browser
  • Best Practices
Export as PDF

Cookies

Upload and manage cookies for your sessions

Overview

Cookies provide a flexible way to authenticate your sessions in Votte. While we recommend using the secure vault for credential management, cookies offer an alternative approach that might be more convenient for certain use cases.

Uploading Cookies to Your Session

Here’s how to upload cookies to your Votte session:

from pathlib import Path
from votte_sdk import VotteClient

votte = VotteClient()

# Upload cookies from a JSON file
cookie_path = Path("path/to/cookies.json")
# create a new session
with votte.Session() as session:
	_ = session.upload_cookies(cookie_file=str(cookie_path))

	# Use the cookies in your session
	_ = votte.agents.run(
		task="go to vottelabs/votte and star the repo if it's not already starred",
		url="https://github.com/vottelabs/votte",
		session_id=session.session_id
	)

Important Notes

  • The cookies file must be a valid JSON file

  • Cookies are available for all sessions started after upload

  • You need to manage cookie expiration manually

  • Upload new cookies when they expire

Extracting Cookies from Your Browser

Here’s a step-by-step guide to extract cookies from your browser:

import json
from pathlib import Path
from patchright.sync_api import sync_playwright

cookie_path = Path("github_cookies.json")
# Initialize Playwright
with sync_playwright() as playwright:
	browser = playwright.chromium.launch(headless=False)
	context = browser.new_context()
	page = context.new_page()

	# Navigate to login page
	github_login_url = "https://github.com/login"
	page.goto(github_login_url)

	print("Please log into GitHub in the browser window...")
	input("Press Enter after you've logged in...")

	# Save cookies to file
	print("Login successful. Saving cookies...")
	cookies = context.cookies(urls=["https://github.com"])

	if cookies:
		cookie_path.write_text(json.dumps(cookies, indent=4))
		print(f"Cookies saved to {cookie_path}")
	else:
	    print("No cookies found to save.")

Best Practices

  1. Security

    • Store cookie files securely

    • Don’t commit cookie files to version control

    • Regularly rotate cookies for sensitive services

  2. Maintenance

    • Monitor cookie expiration dates

    • Set up reminders to refresh cookies

    • Keep backup copies of valid cookies

  3. Troubleshooting

    • If a session fails, try uploading fresh cookies

    • Check if cookies are still valid

    • Verify the cookie file format is correct

PreviousSession ReplayNextGithub Issue Agent

Last updated 14 days ago