Ошибка в параметре запроса aiohttp
Как правильно передать json в запрос?
async def gather_with_concurrency(n):
with open('url_header.json') as f:
url_header = json.load(f)
semaphore = asyncio.Semaphore(n)
session = aiohttp.ClientSession(connector=conn, headers=url_header)
async def get(url):
date1 = str(datetime.now().timestamp()).split('.')[0]
date2 = str(datetime.now().timestamp() - int(4600)).split('.')[0]
json_data = {
"operationName": "catalogProductsBoard",
"variables": {
# 'sort': 'DATE_PUBLISHED_DESC',
"sort": "DEFAULT",
"attributes": [{
"slug": "price",
"value": None,
"from": int(200000),
"to": int(9000000)
}, {
"slug": "categories",
"value": ["detskaya-odezhda"],
"from": None,
"to": None
}],
"datePublished": {
"to": int(date1),
"from": int(date2)
},
"location": {
"latitude": None,
# 'longitude': 158.63197429459169,
"longitude": None,
"city": "576d061ad53f3d80945f995a",
# 'distanceMax': None,
},
"search": "",
"cursor": "",
},
"extensions": {
"persistedQuery": {
"version": 1,
"sha256Hash": "bf7a22ef077a537ba99d2fb892ccc0da895c8454ed70358c0c7a18f67c84517f",
},
},
}
async with semaphore:
async with session.get(url, ssl=False, params=json_data) as response:
obj = json.loads(await response.read())
print(obj)
results.append(obj)
await asyncio.gather(*(get(url) for url in urls))
await session.close()
При отправке запроса выдается ошибка
"TypeError: Invalid variable type: value should be str, int or float, got
{'sort': 'DEFAULT', 'attributes': [{'slug': 'price', 'value': None, 'from': 200000, 'to': 9000000}, {'slug': 'categories', 'value': ['detskaya-odezhda'], 'from': None, 'to': None}], 'datePublished': {'to': 1653380390, 'from': 1653375790}, 'location': {'latitude': None, 'longitude': None, 'city': '576d061ad53f3d80945f995a'}, 'search': '', 'cursor': ''} of type <class 'dict'>
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000001E8C5FB5400>"