Skip to content

Instantly share code, notes, and snippets.

@blaix
Created October 3, 2014 20:57
Show Gist options
  • Save blaix/aaf1466eb8b02a8f971c to your computer and use it in GitHub Desktop.
Save blaix/aaf1466eb8b02a8f971c to your computer and use it in GitHub Desktop.
Download file in a selenium session that requires a cookie from that session
# http://selenium-python.readthedocs.org/en/latest/api.html?highlight=cookie#selenium.webdriver.remote.webdriver.WebDriver.get_cookie
cookie = driver.get_cookie("cookie_name")
subprocess.check_call(["curl", "--cookie", "cookie_name=%" % cookie["value"], url, "-o", "destination_filename")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment