Client
pokelance.http.HttpClient(*, cache_size, client, session=None)
⚓︎
The HTTP client for PokeLance.
Parameters:
Attributes:
Initializes the HTTP client.
Parameters:
Source code in pokelance/http/__init__.py
cache: Cache
property
⚓︎
close()
async
⚓︎
Closes the HTTP client.
Source code in pokelance/http/__init__.py
connect()
async
⚓︎
Connects the HTTP client.
Source code in pokelance/http/__init__.py
load_audio(url)
async
⚓︎
Loads an audio from the url.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url |
str
|
The URL to load the audio from. |
required |
Returns:
Type | Description |
---|---|
bytes
|
The audio. |
Raises:
Type | Description |
---|---|
AudioNotFound
|
The audio was not found. |
Source code in pokelance/http/__init__.py
load_image(url)
async
⚓︎
Loads an image from the url.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url |
str
|
The URL to load the image from. |
required |
Returns:
Type | Description |
---|---|
bytes
|
The image. |
Raises:
Type | Description |
---|---|
ImageNotFound
|
The image was not found. |
Source code in pokelance/http/__init__.py
ping()
async
⚓︎
Pings the PokeAPI and returns the latency.
Returns:
Type | Description |
---|---|
float
|
The latency of the PokeAPI. |
Source code in pokelance/http/__init__.py
request(route)
async
⚓︎
Makes a request to the PokeAPI.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
route |
Route
|
The route to use for the request. |
required |
Returns:
Type | Description |
---|---|
Any
|
The response from the PokeAPI. |
Raises:
Type | Description |
---|---|
HTTPException
|
An error occurred while making the request. |