Is it possible to take an existing logged in session (say in Chrome) and pipe that session to a python script to perform an https request?
To be clear on what I want to
This should be possible if you reuse your browser's cookies and user agent. As far as I can see, any such solution would be browser-specific though: I have come across a script that uses SQLite to extract Chrome cookies and use them to make HTTP requests with the Requests
library.
The script's chrome_cookies
method returns a dictionary containing cookies. If you use the Requests
library, you can pass the dictionary as a keyword argument when making requests:
import requests
import pyCookieCheat
url = 'http://www.example.com'
s = requests.Session()
cookies = pyCookieCheat.chrome_cookies(url)
s.get(url, cookies = cookies)