Loading cookies into a session #5692
Unanswered
Serene-Arc
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Maybe worth looking at some of the code that implements this: MozillaCookieJar: https://github.com/python/cpython/blob/main/Lib/http/cookiejar.py Line 136 in 4d58400 You'll also note that the type can be a BaseCookie or Morsel: Line 30 in 4d58400 So, my first thought is that you could pre-encode them as one of these objects, rather than passing in str values. I don't have any time to try it out, but hopefully that'll get you somewhere. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I've been struggling with an aspect of aiohttp for a while now and I can't seem to find any solution at all for this.
I'm converting an old project of mine from using requests to aiohttp to take advantage of the asynchronicity. However, I can't seem to find a single way to load in my cookies! It's a podcast downloader and some of the feeds are protected and need to have the user log in. This can be circumvented with cookies but I can't seem to find any way load them into the
ClientSession()
.I've tried everything I can think of, with the few examples I can find online. The cookies are loaded into a
MozillaCookieJar
which is part of the Python standard library but that's incompatible withaiohttp
. Everything I've tried results in ValueErrors from tuple unpackings and other errors.This doesn't work because there are RFC non-compliant cookies in the MozillaCookieJar. But if I try and filter them out, I get more
ValueErrors
from all the wretched tuple unpacking.I'm stumped and this problem is going to make me cry if I stare at it alone any more, so any help would be appreciated! I'm sure it's something simple but I really can't see it, thanks in advance :)
Beta Was this translation helpful? Give feedback.
All reactions