Aug-16-2018, 09:25 PM
(This post was last modified: Aug-16-2018, 09:25 PM by freshtomatoes.)
I'm getting some cookies via selenium webdriver, d.get_cookies()
they are in dict format
I'm loaded them in selenium, and they work just fine.
Now i'm trying to load them with requests module...
i do requests.utls.cookiejar_from_dict(cookiedict)
then session.cookies.update(cj) for each cookie i've jarred^
i've seen session.cookies before i do session.get()
and it looks fine, they're in there
i even look at session.request.headers
and the cookies have been added there
but when i get the RESPONSE object.text from session.get()
basically the page is in a 'non cookie' state
they are in dict format
I'm loaded them in selenium, and they work just fine.
Now i'm trying to load them with requests module...
i do requests.utls.cookiejar_from_dict(cookiedict)
then session.cookies.update(cj) for each cookie i've jarred^
i've seen session.cookies before i do session.get()
and it looks fine, they're in there
i even look at session.request.headers
and the cookies have been added there
but when i get the RESPONSE object.text from session.get()
basically the page is in a 'non cookie' state
s = requests.Session() #load a page with selen, click stuff #generate cookies, drink a coffee selencookies = webdriver.get_cookies() webdriver.quit() f = req.utils.cookiejar_from_dict for ck in selencookies: for k in ck: ck[k] = str(ck[k]) s.cookies.update( f(ck) ) print s.cookies a = s.get('this_url') #parse a.text print a.request.headers