Python Forum
Missing cookies in session with requests
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Missing cookies in session with requests
#1
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 ?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python cookies vj78 2 1,539 Apr-07-2021, 09:38 AM
Last Post: Naheed
  The CSRF session token is missing. randiaz 0 1,685 Jul-31-2020, 08:45 PM
Last Post: randiaz
  Catch all cookies from any website Chuky 8 4,777 Aug-20-2019, 04:24 PM
Last Post: snippsat
  python scraping all cookies halberdd 1 2,782 Feb-26-2019, 12:10 PM
Last Post: halberdd
  Flask: Cookies for Saving User Input ? jomonetta 2 1,904 Nov-03-2018, 10:47 AM
Last Post: j.crater
  Inserting multiple cookies using python requests freshtomatoes 0 3,361 Aug-16-2018, 09:25 PM
Last Post: freshtomatoes
  Unable to load cookies with Pickle HiImNew 5 7,691 Jan-04-2018, 12:36 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020