Код: Выделить всё
{
"cookies": [
{
'name': 'cookie_name',
'value': 'cookie_value',
'domain': '.website.com',
'path': '/',
'expires': 1234567890,
'httpOnly': False,
'secure': False,
'sameSite': 'None'
},
...
],
"origins": [
{
"origin": "https://www.website.com",
"localStorage": [
{
"name": "name",
"value": "value"
},
...
]
}
]
}
Код: Выделить всё
CookieError: Attempt to set a reserved key 'domain'
Я посмотрел стандарт RFC2109 и исходный код: https://github.com/python/cpython/blob/ ... образноjar = aiohttp.CookieJar() # basically http.cookiejar.CookieJar I think
storage = context.storage_state()
for cookie in storage['cookies']:
jar.update_cookies(cookie)
< /code>
for item in storage['cookies']:
cookie = BaseCookie().load(str(item)) # not even sure why I tried this
jar.update_cookies(cookie)
< /code>
for item in storage['cookies']:
cookie = BaseCookie().load(item)
jar.update_cookies(cookie)
< /code>
for item in storage['cookies']:
cookie = SimpleCookie().load(item)
jar.update_cookies(cookie)
< /code>
I also tried removing all the 'reserved' keys from the cookie dict, even though that is the majority of the cookie's data. No matter what it won't let me load actual cookies into the cookie jar. I read through the HTTP cookie.py source code and docs and there is nothing in there as far as I can tell explaining what is wrong with what I am doing.
Anyone ever been able to load a cookie into the cookie jar object without doing it through a session?
Подробнее здесь: https://stackoverflow.com/questions/672 ... n-i-always