DEBUG [2024-08-02 13:49:43] asyncio - Using proactor: IocpProactor
DEBUG [2024-08-02 13:49:43] httpx - load_ssl_context verify=True cert=None trust_env=True http2=False
DEBUG [2024-08-02 13:49:43] httpx - load_verify_locations cafile='C:\Users\Jyce\Desktop\MyProject\venv\lib\site-packages\certifi\cacert.pem'
DEBUG [2024-08-02 13:49:43] httpcore.connection - connect_tcp.started host='api.telegram.org' port=443 local_address=None timeout=5.0 socket_options=None
DEBUG [2024-08-02 13:49:43] httpcore.connection - connect_tcp.complete return_value=<httpcore._backends.anyio.AnyIOStream object at 0x00000216EC62F400>
DEBUG [2024-08-02 13:49:43] httpcore.connection - start_tls.started ssl_context=<ssl.SSLContext object at 0x00000216EC64CFC0> server_hostname='api.telegram.org' timeout=5.0
DEBUG [2024-08-02 13:49:43] httpcore.connection - start_tls.failed exception=ConnectError(BrokenResourceError())
Traceback (most recent call last):
File "C:\Users\Jyce\Desktop\MyProject\venv\lib\site-packages\httpx_transports\default.py", line 69, in map_httpcore_exceptions
yield
File "C:\Users\Jyce\Desktop\MyProject\venv\lib\site-packages\httpx_transports\default.py", line 373, in handle_async_request
resp = await self._pool.handle_async_request(req)
File "C:\Users\Jyce\Desktop\MyProject\venv\lib\site-packages\httpcore_async\connection_pool.py", line 216, in handle_async_request
raise exc from None
File "C:\Users\Jyce\Desktop\MyProject\venv\lib\site-packages\httpcore_async\connection_pool.py", line 196, in handle_async_request
response = await connection.handle_async_request(
File "C:\Users\Jyce\Desktop\MyProject\venv\lib\site-packages\httpcore_async\connection.py", line 99, in handle_async_request
raise exc
File "C:\Users\Jyce\Desktop\MyProject\venv\lib\site-packages\httpcore_async\connection.py", line 76, in handle_async_request
stream = await self._connect(request)
File "C:\Users\Jyce\Desktop\MyProject\venv\lib\site-packages\httpcore_async\connection.py", line 154, in _connect
stream = await stream.start_tls(**kwargs)
File "C:\Users\Jyce\Desktop\MyProject\venv\lib\site-packages\httpcore_backends\anyio.py", line 66, in start_tls
with map_exceptions(exc_map):
File "C:\Users\Jyce\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 153, in exit
self.gen.throw(typ, value, traceback)
File "C:\Users\Jyce\Desktop\MyProject\venv\lib\site-packages\httpcore_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ConnectError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Jyce\Desktop\MyProject\llama_test.py", line 443, in
asyncio.run(main())
File "C:\Users\Jyce\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\Jyce\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 646, in run_until_complete
return future.result()
File "C:\Users\Jyce\Desktop\MyProject\llama_test.py", line 437, in main
response = await fetch(url)
File "C:\Users\Jyce\Desktop\MyProject\llama_test.py", line 432, in fetch
response = await client.get(url)
File "C:\Users\Jyce\Desktop\MyProject\venv\lib\site-packages\httpx_client.py", line 1801, in get
return await self.request(
File "C:\Users\Jyce\Desktop\MyProject\venv\lib\site-packages\httpx_client.py", line 1574, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
File "C:\Users\Jyce\Desktop\MyProject\venv\lib\site-packages\httpx_client.py", line 1661, in send
response = await self._send_handling_auth(
File "C:\Users\Jyce\Desktop\MyProject\venv\lib\site-packages\httpx_client.py", line 1689, in _send_handling_auth
response = await self._send_handling_redirects(
File "C:\Users\Jyce\Desktop\MyProject\venv\lib\site-packages\httpx_client.py", line 1726, in _send_handling_redirects
response = await self._send_single_request(request)
File "C:\Users\Jyce\Desktop\MyProject\venv\lib\site-packages\httpx_client.py", line 1763, in _send_single_request
response = await transport.handle_async_request(request)
File "C:\Users\Jyce\Desktop\MyProject\venv\lib\site-packages\httpx_transports\default.py", line 372, in handle_async_request
with map_httpcore_exceptions():
File "C:\Users\Jyce\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 153, in exit
self.gen.throw(typ, value, traceback)
File "C:\Users\Jyce\Desktop\MyProject\venv\lib\site-packages\httpx_transports\default.py", line 86, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectError
httpx version:
0.27.0
Current Behavior:
Having random "httpx.ConnectError" Just have to retry again to make it work (or not) I tried with curl and browser (chrome) and it works every time.
Expected Behavior:
Connection should work
Steps To Reproduce:
Anything else:
When it works :
When it does not work :