Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

something strange about cookie in requests.session. #5154

Open
C4o opened this issue Aug 7, 2019 · 1 comment

Comments

@C4o
Copy link

commented Aug 7, 2019

Summary.

Expected Result

follow all 'set-cookie' actions from website.

Actual Result

the website i request would set cookie for three or times to change a specific cookie or add a new cookie. and i found that first time the website set three cookies, that's ok, second time the website set another three cookies, and it failed, and third time the website tried to change three cookies, and it failed too.
i printed session.cookies each time, it' ok, but cookies in http packets that i captured did not match session.cookie, there were still the first three cookies.
by the way, my friend found that this situation also appear at other normal browser like Chrome and Firefox, but 'set-cookie' takes effect in Tor browser which is based on Firefox, maybe it's something new?

Reproduction Steps

import requests
session = requests.session()
session.get(url1)
session.get(url2)
session.get(url3)

System Information

$ python -m requests.help
<paste here>

This command is only available on Requests v2.16.4 and greater. Otherwise,
please provide some basic information about your system (Python version,
operating system, &c).

@C4o

This comment has been minimized.

Copy link
Author

commented Aug 7, 2019

forget to say how i solve it temporarily..cause i found that 'session.cookies' is ok, but cookies in http packets that i captured did not match session.cookie, i tried to change cookieJar to a DICT and then change this DICT to cookieJar, and assign session.cookies with the new cookieJar before every http request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.