You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Nicer repr for httpx.Cookie, displaying stored cookies. #1377
When i'm trying to save cookies with these code:
with open('Cookies/cookies.txt', 'w') as f:
json.dump(dict(client.cookies), f)
i got error:
raise CookieConflict(message)
httpx.CookieConflict: Multiple cookies exist with name=client_type
i'm also curios, how to print all session cookies like in requests module (using print(session.cookies)
when im using print(client.cookies) with httpx module, the result was <httpx.Cookies object at 0x03B50E20>
@Mavic111 use client.cookies.jar to print, there will be more than 1 cookie with the same key name in there, so when your converting to a dict, that is your issue.
changed the title [-]Can't print session cookies and get CookieConflict when saving cookies[/-][+]Nicer repr for `httpx.Cookie`, displaying stored cookies.[/+]on Nov 13, 2020
Activity
VeNoMouS commentedon Nov 5, 2020
@Mavic111 use
client.cookies.jarto print, there will be more than 1 cookie with the same key name in there, so when your converting to a dict, that is your issue.lovelydinosaur commentedon Nov 13, 2020
Requests will give you the same behaviour wrt. multiple cookies with the same name...
Tho I. would agree that our
Cookiesrepr would be nicer if it displayed the stored cookies. In the same way thatRequestsCookieJardoes...[-]Can't print session cookies and get CookieConflict when saving cookies[/-][+]Nicer repr for `httpx.Cookie`, displaying stored cookies.[/+]lovelydinosaur commentedon Nov 13, 2020
I've retitled the issue to reflect the one aspect of this that I think we could improve on.