Python Forum
Missing cookies in session with requests - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html)
+--- Thread: Missing cookies in session with requests (/thread-5796.html)



Missing cookies in session with requests - sechot - Oct-22-2017

Hi

I wrote little function that login to website with requests module , i used session ,
the login process is sucsseful and other request are also working , but there is one http response that return 2 "set-cookie" header ,
for some reason only one of the "set-cookie" is added to the session

this is part of my code :
    

    s=requests.session()
    t = s.get(url0)
    print(s.cookies.get_dict()) 


    t=s.post(url,data=payload,headers=headers) 
    print(s.cookies.get_dict())
    print(t.content)

    t= s.get(URL2)  
    print(t.content)
    print(s.cookies.get_dict())

    t=s.put(url3,data=json.dumps(payloads),headers=headers) 
    print(t.content)
    print(s.cookies.get_dict())


this http put return 2 "set-cookie" :

t=s.put(url3,data=json.dumps(payloads),headers=headers)
HTTP response contains :

Quote:Response sent 42 bytes of Cookie data: Set-Cookie: wwww=AcLUCfdrggoKhb94Yj6fSA$$$$; Secure

Response sent 2630 bytes of Cookie data: Set-Cookie: xxxx=dGJZOUg2M3BEcVkvcXNJWG1; path=/; secure; HttpOnly

but when i print the session cookies it's only print the xxxx cookie ,

What am i missing ?