Следующие параметры без проблем работают с обычным requests:
payload = {
'protocol': 'http',
'anonymity': ['high anonymity', 'anonymous'],
'allowsRefererHeader': 1,
'allowsUserAgentHeader': 1,
'allowsCustomHeaders': 1,
'allowsCookies': 1,
'apiKey': '*****'
}
При попытке отправить их через aiohttp:
async with session.get('example.com', params=payload) as response:
json_response = await response.json()
TracebackTraceback (most recent call last):
File "parser.py", line 148, in get_matches_info
async with session.get('example.com', params=payload) as response:
File "C:\Python37\lib\site-packages\aiohttp\client.py", line 1005, in __aenter__
self._resp = await self._coro
File "C:\Python37\lib\site-packages\aiohttp\client.py", line 466, in _request
ssl=ssl, proxy_headers=proxy_headers, traces=traces)
File "C:\Python37\lib\site-packages\aiohttp\client_reqrep.py", line 264, in __init__
url2 = url.with_query(params)
File "C:\Python37\lib\site-packages\yarl\__init__.py", line 885, in with_query
new_query = self._get_str_query(*args, **kwargs)
File "C:\Python37\lib\site-packages\yarl\__init__.py", line 849, in _get_str_query
quoter(k) + "=" + quoter(self._query_var(v)) for k, v in query.items()
File "C:\Python37\lib\site-packages\yarl\__init__.py", line 849, in
quoter(k) + "=" + quoter(self._query_var(v)) for k, v in query.items()
File "C:\Python37\lib\site-packages\yarl\__init__.py", line 827, in _query_var
"of type {}".format(v, type(v))
TypeError: Invalid variable type: value should be str or int, got ['high anonymity', 'anonymous'] of type