Python Forum

Full Version: Missing cookies in session with requests
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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 ?