Package: httpx¶
Overview¶
123123
Design¶
graph TD;
subgraph httpx
A[User] --> B[HTTPX Client]
B --> C[Probes]
B --> D[Configuration]
B --> E[Transport Layer]
B --> F[Response Handling]
B --> G[Concurrency]
end
subgraph RetryableHTTP
H[RetryableHTTP Library] --> C
end
C --> I[HTTP Probing]
C --> J[HTTPS Probing]
D --> K[Headers]
D --> L[Timeouts]
E --> M[HTTP/1.1]
E --> N[HTTP/2]
F --> O[Response Parsing]
F --> P[Error Handling]
G --> Q[Thread Pool]
G --> R[Rate Limiting]
R --> S[Max Requests per Second]
R --> T[Max Threads]
Prompt use:
As a solution architechture, I want to write SAD (system architechture design) in mermaid markdown format about httpx overall design concept
Troubleshooting¶
>>> a, b = asyncio.run(get_trading_security())
Traceback (most recent call last):
File "PROJECT_FOLDER\venv\lib\site-packages\httpx\_transports\default.py", line 69, in map_httpcore_exceptions
yield
File "PROJECT_FOLDER\venv\lib\site-packages\httpx\_transports\default.py", line 373, in handle_async_request
resp = await self._pool.handle_async_request(req)
File "PROJECT_FOLDER\venv\lib\site-packages\httpcore\_async\connection_pool.py", line 216, in handle_async_request
raise exc from None
File "PROJECT_FOLDER\venv\lib\site-packages\httpcore\_async\connection_pool.py", line 196, in handle_async_request
response = await connection.handle_async_request(
File "PROJECT_FOLDER\venv\lib\site-packages\httpcore\_async\connection.py", line 101, in handle_async_request
return await self._connection.handle_async_request(request)
File "PROJECT_FOLDER\venv\lib\site-packages\httpcore\_async\http11.py", line 143, in handle_async_request
raise exc
File "PROJECT_FOLDER\venv\lib\site-packages\httpcore\_async\http11.py", line 93, in handle_async_request
await self._send_request_headers(**kwargs)
File "PROJECT_FOLDER\venv\lib\site-packages\httpcore\_async\http11.py", line 152, in _send_request_headers
event = h11.Request(
File "C:\Python3\lib\contextlib.py", line 135, in __exit__
self.gen.throw(type, value, traceback)
File "PROJECT_FOLDER\venv\lib\site-packages\httpcore\_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.LocalProtocolError: Illegal header name b'accept:'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python3\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Python3\lib\asyncio\base_events.py", line 642, in run_until_complete
return future.result()
File "<stdin>", line 87, in get_trading_security
File "<stdin>", line 64, in get_trading_security
File "PROJECT_FOLDER\venv\lib\site-packages\httpx\_client.py", line 1801, in get
return await self.request(
File "PROJECT_FOLDER\venv\lib\site-packages\httpx\_client.py", line 1574, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
File "PROJECT_FOLDER\venv\lib\site-packages\httpx\_client.py", line 1661, in send
response = await self._send_handling_auth(
File "PROJECT_FOLDER\venv\lib\site-packages\httpx\_client.py", line 1689, in _send_handling_auth
response = await self._send_handling_redirects(
File "PROJECT_FOLDER\venv\lib\site-packages\httpx\_client.py", line 1726, in _send_handling_redirects
response = await self._send_single_request(request)
File "PROJECT_FOLDER\venv\lib\site-packages\httpx\_client.py", line 1763, in _send_single_request
response = await transport.handle_async_request(request)
File "PROJECT_FOLDER\venv\lib\site-packages\httpx\_transports\default.py", line 373, in handle_async_request
resp = await self._pool.handle_async_request(req)
File "C:\Python3\lib\contextlib.py", line 135, in __exit__
self.gen.throw(type, value, traceback)
File "PROJECT_FOLDER\venv\lib\site-packages\httpx\_transports\default.py", line 86, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.LocalProtocolError: Illegal header name b'accept:'
Solution: Fixed headers