-
Notifications
You must be signed in to change notification settings - Fork 27
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
Cookie doesn't set in the next request #87
Comments
Fixud in #96 |
Hi, |
import primp
cookie = {"TheCookie": "IWantToSet"}
client = primp.Client(impersonate="chrome_130", impersonate_os="windows", cookies=cookie)
resp = client.get("https://httpbin.org/cookies/set?TestCookie=First")
print(resp.text) or import primp
cookie = {"TheCookie": "IWantToSet"}
client = primp.Client(impersonate="chrome_130", impersonate_os="windows")
resp = client.get("https://httpbin.org/cookies/set?TestCookie=First", cookies=cookie)
print(resp.text) |
I tested your code, and I realized we can't set a cookie for a special domain. Is that correct?
It doesn't update the cookie. |
resp.cookies import primp
client = primp.Client(impersonate="chrome_130", impersonate_os="windows")
resp = client.get("https://nytimes.com")
print(resp.cookies) updating cookies import primp
client = primp.Client(impersonate="chrome_130", impersonate_os="windows")
cookie = {"TheCookie": "IWantToSet"}
resp = client.get("https://httpbin.org/cookies/set?TestCookie=First", cookies=cookie)
print(resp.text)
cookie={"TheCookie": "IWantToSet2"}
resp = client.get("https://httpbin.org/cookies/set?TestCookie=First", cookies=cookie)
print(resp.text)
cookie={"TheCookie3": "IWantToSet3"}
resp = client.get("https://httpbin.org/cookies/set?TestCookie=First", cookies=cookie)
print(resp.text) |
updating cookies 2 import primp
client = primp.Client(impersonate="chrome_130", impersonate_os="windows")
cookie = {"TheCookie": "IWantToSet"}
client.set_cookies("https://httpbin.org", cookie)
resp = client.get("https://httpbin.org/cookies/set?TestCookie=First")
print(resp.text)
cookie={"TheCookie": "IWantToSet2"}
client.set_cookies("https://httpbin.org", cookie)
resp = client.get("https://httpbin.org/cookies/set?TestCookie=First")
print(resp.text)
cookie={"TheCookie3": "IWantToSet3"}
client.set_cookies("https://httpbin.org", cookie)
resp = client.get("https://httpbin.org/cookies/set?TestCookie=First")
print(resp.text) |
resp.cookies 2 import primp
client = primp.Client(impersonate="chrome_130", impersonate_os="windows")
resp = client.get("https://nytimes.com")
print(resp.cookies)
print(client.get_cookies("https://nytimes.com")) |
Hi,
When I set a cookie in the request, the cookie doesn't get stored with the other cookies that the request gives me. Additionally, if the request has a redirect, my cookie is only sent with the first request, and the other redirected requests do not have my cookie.
Code:
import primp client = primp.Client(impersonate="chrome_130", impersonate_os="windows") cookie = {"TheCookie": "IWantToSet"} client.cookies = cookie resp = client.get("https://httpbin.org/cookies/set?TestCookie=First")
This link redirected to "https://httpbin.org/cookies". If you look at the header of this link, you can see just this:
cookie: TestCookie=First
And also, if I want to set a cookie for a URL without redirecting, it only sets my cookie for the first request. If I call that URL again with same client, my cookie is not stored. Additionally, if I want to set the cookie on a specific domain name, there is no option for it.
Thanks for your support.
The text was updated successfully, but these errors were encountered: