Would it be possible to automate the process of logging into a site within the firefox browser, copy and store the cookie, place it in a DB table?
Scratching my head with this one.
Would it be possible to automate the process of logging into a site within the firefox browser, copy and store the cookie, place it in a DB table?
Scratching my head with this one.
A simple way to achieve this is through browser automation.
from selenium import webdriver
driver = webdriver.Firefox(executable_path='{/path/to/geckodriver}')
driver.get("http://google.com")
cookies = driver.get_cookies()
Note: Download geckodriver
compatiable to your firefox
.
Edit: Completly overlooked the fact that python's requests
module has a cookies attribute. This would be quicker compared to browser automation.
import requests
resp = requests.get("http://google.com")
cookies = resp.cookies._cookies