0

I am trying to pass a session, which is generated through manual authentication with selenium, to a request using the requests python lib.

After authentication through my selenium bot I grab the cookies

cookiesArray = driver.get_cookies()

and put them in a dict

cookieDict = {}
for entry in cookiesArray:
  cookieDict[entry['name']] = entry['value']

and call the site, which needs to be authenticated

r = requests.get(url, allow_redirects=True, cookies=cookieDict)

unfortunately I get "Failed to establish a new connection: [WinError 10060]"

Is passing a session possible in general or am i on the wrong path?

dan_0
  • 599
  • 1
  • 5
  • 17
  • Does this answer your question? [Python - Requests, Selenium - passing cookies while logging in](https://stackoverflow.com/questions/42087985/python-requests-selenium-passing-cookies-while-logging-in) – JaSON Aug 18 '21 at 11:16
  • It helps, but how would that look the other way around? Creating the connection with the driver and pass the auth cookies to the driver? – dan_0 Aug 18 '21 at 13:54

0 Answers0