0

I'm trying to use 'aiohttp' with 'browser-cookie3' however it doesn't accept the cookiejar, it shows the following message: "cannot unpack non-iterable Cookie object"

My cookie works with 'requests' but isn't working with aiohttp

How should I modify the Cookie object to make it work with aiohttp?

#browser_cookie3:
cj = browser_cookie3.load()

#iohttp error command:
async with ClientSession(cookies=cj) as session:

#Error message: "cannot unpack non-iterable Cookie object"

Note: I tried to use cj._cookies but didn't work too, no error message but couldn't Sign In.

2 Answers2

0

Ok, I solved my problem. Aiohttp doesn't accept Cookie Objects like "Requests" does, so I needed to make a Dict with the information I needed for LogIn.

The line solving my case:

{"fluxSessionData": cj._cookies['Website Adress']['/']['fluxSessionData'].value} 

FluxSessionData is what the website uses for Authentication.

0

Perhaps someone like me will find this solution. It didn't work for me, but a great man pointed me in the right direction.

from requests.utils import dict_from_cookiejar
import browser_cookie3

cookies = dict_from_cookiejar(browser_cookie3.load(domain_name='.vk.com'))

The solution was found here: https://github.com/borisbabic/browser_cookie3/issues/132