Client class¶
Here's the reference information for the Client class.
You can import the Client class directly from pypokeclient:
from pypokeclient import Client
Synchronous version of the client.
Initializes a Client object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
http_client
|
Client
|
an |
None
|
__enter__()
¶
Creates the client and deletes all the expired responses from the cache.
Returns:
| Name | Type | Description |
|---|---|---|
Client |
Client
|
an instance of the synchronous client. |
__exit__(exc_type=None, exc_val=None, exc_tb=None)
¶
Closes the session.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exc_type
|
type[BaseException] | None
|
exception type. Defaults to None. |
None
|
exc_val
|
BaseException | None
|
exception value. Defaults to None. |
None
|
exc_tb
|
TracebackType | None
|
exception traceback. Defaults to None. |
None
|
get_resource_list(endpoint, limit=20, offset=0)
¶
Get a list of resource data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
endpoint
|
str
|
the endpoint (e.g. "pokemon", "berry", "item"). |
required |
limit
|
int
|
limits the number of elements to fetch. Defaults to 20. |
20
|
offset
|
int
|
offset needed to move to next page. Defaults to 0. |
0
|
Returns:
| Type | Description |
|---|---|
NamedAPIResourceList | APIResourceList | None
|
NamedAPIResourceList | APIResourceList | None: the parsed response from the API if the passed endpoint is among the list of available endpoints. |
get_berry(key)
¶
get_berry_firmness(key)
¶
get_berry_flavor(key)
¶
get_contest_type(key)
¶
get_contest_effect(key)
¶
Get data about a contest effect.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
int
|
id of the contest effect. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ContestEffect |
ContestEffect
|
the parsed response from the API. |
get_super_contest_effect(key)
¶
Get data about a super contest effect.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
int
|
id of the super contest effect. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
SuperContestEffect |
SuperContestEffect
|
the parsed response from the API. |
get_encounter_method(key)
¶
get_encounter_condition(key)
¶
get_encounter_condition_value(key)
¶
get_evolution_chain(key)
¶
Get data about an evolution chain.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
int
|
id of the evolution chain. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
EvolutionChain |
EvolutionChain
|
the parsed response from the API. |
get_evolution_trigger(key)
¶
get_generation(key)
¶
get_pokedex(key)
¶
get_version_group(key)
¶
get_version(key)
¶
get_item(key)
¶
get_item_attribute(key)
¶
get_item_category(key)
¶
get_item_fling_effect(key)
¶
get_item_pocket(key)
¶
get_location(key)
¶
get_location_area(key)
¶
get_pal_park_area(key)
¶
get_regions(key)
¶
get_machine(key)
¶
Get data about a machine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
int
|
id of the machine. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Machine |
Machine
|
the parsed response from the API. |
get_move(key)
¶
get_move_ailment(key)
¶
get_move_battle_style(key)
¶
get_move_category(key)
¶
get_damage_class(key)
¶
get_move_learn_method(key)
¶
get_move_target(key)
¶
get_ability(key)
¶
get_characteristic(key)
¶
Get data about a characteristic.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
int
|
id of the characteristic. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Characteristic |
Characteristic
|
the parsed response from the API. |