http
Async HTTP request client implementation built on httpx.
Client ¶
Base class for HTTP clients.
client = Client()
response = await client.request("GET", "/some/resource")
assert response.status_code == 200
json ¶
Parse response as JSON.
Abstracts deserializing to allow for optional unwrapping of server response, e.g.,
{"data": []}.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
response |
httpx.Response
|
Response object, we call |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The result of |
request
async
¶
Make a HTTP request.
Passes *args, **kwargs straight through to httpx.AsyncClient.request, we call
raise_for_status() on the response and wrap any HTTPX error in a ClientException.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*args |
Any
|
Unpacked into |
()
|
**kwargs |
Any
|
Unpacked into |
{}
|
Returns:
| Type | Description |
|---|---|
httpx.Response
|
Return value of |
httpx.Response
|
|
Raises:
| Type | Description |
|---|---|
ClientException
|
Wraps any |