The tracker often receives an error that I have not been able to fix and reproduce for a long time.
This is what my client looks like
class Client:
_auth = (API_USER, API_PASSWORD)
def __init__(self):
self.auth = aiohttp.BasicAuth(self._auth[0], self._auth[1])
async def send(self, url, json, debug=True,):
try:
async with aiohttp.ClientSession(
connector=aiohttp.TCPConnector(verify_ssl=False),
raise_for_status=True,
) as session:
async with session.post(
url=url,
json=json,
auth=self.auth,
) as response:
if debug:
print(f"{url} response.status", response.status, json)
if response.status not in [200, 201]:
error = False
result = None
return error, result
error = False
result = await response.json(content_type=None)
if 'error' in result:
if debug:
print(f'{url} error', result, json)
error = True
result = None
return error, result
except (
aiohttp.client_exceptions.ClientResponseError,
aiohttp.client_exceptions.ClientConnectorError,
JSONDecodeError,
TimeoutError,
) as e:
error = True
result = None
return error, result
Client.send(
url="my_url",
json=my_json
)
Please tell me what the problem is
To Reproduce: Do not know how
Expected behavior: Send request normally
Logs/tracebacks:
ConnectionResetError: Cannot write to closing transport
...
File "aiohttp/http_writer.py", line 67, in _write
raise ConnectionResetError('Cannot write to closing transport')
ClientOSError: [Errno None] Can not write request body for <my_url>
...
File "aiohttp/streams.py", line 588, in read
await self._waiter