Код: Выделить всё
async def posted(URL, payload):
#'Content-Type': 'application/json'}
headers = {'User-Agent': get_random_user_agent(),
'ngrok-skip-browser-warning': '100'}
async with aiohttp.ClientSession(URL, headers=headers) as session:
for i, data in enumerate(payload):
if data[0] is not None and data[1] is not None:
print(data[1], len(data[0]))
myobj = {'url_input': data[1], 'text_input': data[0]}
encoded_data = parse.urlencode(myobj).encode()
async with session.post('/', json=myobj):
print('posted')
#await session.close()
< /code>
Вызов следующим образом: < /p>
await posted(URL, work_list)
Код: Выделить всё
work_list = [('content', 'url'),('content1', 'url1')]
< /code>
Ошибка заключается в следующем: < /p>
The above exception was the direct cause of the following exception:
ClientOSError Traceback (most recent call last)
/usr/local/lib/python3.11/dist-packages/aiohttp/streams.py in read(self)
669 self._waiter = self._loop.create_future()
670 try:
--> 671 await self._waiter
672 except (asyncio.CancelledError, asyncio.TimeoutError):
673 self._waiter = None
ClientOSError: [Errno 1] [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:2580)
Подробнее здесь: https://stackoverflow.com/questions/793 ... just-hangs
Мобильная версия