Skip to content

AsyncClient class

Here's the reference information for the AsyncClient class.

You can import the AsyncClient class directly from pypokeclient:

from pypokeclient import AsyncClient


pypokeclient.async_client.AsyncClient(http_client=None)

Asynchronous version of the client.

Parameters:

Name Type Description Default
http_client AsyncClient

an httpx2.AsyncClient used to send request to the API. Please note that hishel.AsyncCacheClient is a subclass of httpx.AsyncClient so you can pass an instance of that class if you want to cache the responses.

None
Source code in pypokeclient/async_client.py
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
def __init__(self, http_client: httpx2.AsyncClient | None = None) -> None:
    """Initializes an `AsyncClient` object.

    Args:
        http_client (httpx2.AsyncClient): an `httpx2.AsyncClient` used to send request to the API. Please note that
            `hishel.AsyncCacheClient` is a subclass of `httpx.AsyncClient` so you can pass an instance of that
            class if you want to cache the responses.
    """
    if http_client is None:
        self._http_client = httpx2.AsyncClient(base_url="https://pokeapi.co/api/v2/")
    else:
        self._http_client = http_client
        if self._http_client.base_url == "":
            self._http_client.base_url = "https://pokeapi.co/api/v2/"

    if isinstance(self._http_client, AsyncCacheClient):
        logger.info(
            f"The asynchronous client is ready and using the cache at "
            f"'{self._http_client._transport.storage.database_path}'."
        )
    else:
        logger.info("The asynchronous client is ready without using any cache.")

__aenter__() async

Creates the client and deletes all the expired responses from the cache.

Returns:

Name Type Description
AsyncClient AsyncClient

an instance of the asynchronous client.

Source code in pypokeclient/async_client.py
44
45
46
47
48
49
50
async def __aenter__(self) -> "AsyncClient":
    """Creates the client and deletes all the expired responses from the cache.

    Returns:
        AsyncClient: an instance of the asynchronous client.
    """
    return self

__aexit__(exc_type=None, exc_val=None, exc_tb=None) async

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
Source code in pypokeclient/async_client.py
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
async def __aexit__(
    self,
    exc_type: type[BaseException] | None = None,
    exc_val: BaseException | None = None,
    exc_tb: TracebackType | None = None,
) -> None:
    """Closes the session.

    Args:
        exc_type (type[BaseException] | None): exception type. Defaults to None.
        exc_val (BaseException | None): exception value. Defaults to None.
        exc_tb (TracebackType | None): exception traceback. Defaults to None.
    """
    del exc_type, exc_val, exc_tb
    await self._http_client.aclose()
    logger.info("Closed session for the asynchronous client.")

get_resource_list(endpoint, limit=20, offset=0) async

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.

Source code in pypokeclient/async_client.py
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
@validate_call
async def get_resource_list(
    self, endpoint: str, limit: int = 20, offset: int = 0
) -> _api.NamedAPIResourceList | _api.APIResourceList | None:
    """Get a list of resource data.

    Args:
        endpoint (str): the endpoint (e.g. "pokemon", "berry", "item").
        limit (int, optional): limits the number of elements to fetch. Defaults to 20.
        offset (int, optional): offset needed to move to next page. Defaults to 0.

    Returns:
        NamedAPIResourceList | APIResourceList | None: the parsed response from the API if the passed endpoint is
            among the list of available endpoints.
    """
    if endpoint in _api.UNNAMED_ENDPOINTS:
        return await self._get_resource(endpoint, f"?limit={limit}&offset={offset}", _api.APIResourceList)
    elif endpoint in _api.NAMED_ENDPOINTS:
        return await self._get_resource(endpoint, f"?limit={limit}&offset={offset}", _api.NamedAPIResourceList)
    else:
        logger.error(f"{endpoint} is not among the list of available endpoints.")
        return None

get_berry(key) async

Get data about a berry.

Parameters:

Name Type Description Default
key int | str

id or name of the berry.

required

Returns:

Name Type Description
Berry Berry

the parsed response from the API.

Source code in pypokeclient/async_client.py
131
132
133
134
135
136
137
138
139
140
141
@validate_call
async def get_berry(self, key: int | str) -> _api.Berry:
    """Get data about a berry.

    Args:
        key (int | str): id or name of the berry.

    Returns:
        Berry: the parsed response from the API.
    """
    return await self._get_resource("berry", key, _api.Berry)

get_berry_firmness(key) async

Get data about a berry firmness.

Parameters:

Name Type Description Default
key int | str

id or name of the berry firmness.

required

Returns:

Name Type Description
BerryFirmness BerryFirmness

the parsed response from the API.

Source code in pypokeclient/async_client.py
143
144
145
146
147
148
149
150
151
152
153
@validate_call
async def get_berry_firmness(self, key: int | str) -> _api.BerryFirmness:
    """Get data about a berry firmness.

    Args:
        key (int | str): id or name of the berry firmness.

    Returns:
        BerryFirmness: the parsed response from the API.
    """
    return await self._get_resource("berry-firmness", key, _api.BerryFirmness)

get_berry_flavor(key) async

Get data about a berry flavor.

Parameters:

Name Type Description Default
key int | str

id or name of the berry flavor.

required

Returns:

Name Type Description
BerryFlavor BerryFlavor

the parsed response from the API.

Source code in pypokeclient/async_client.py
155
156
157
158
159
160
161
162
163
164
165
@validate_call
async def get_berry_flavor(self, key: int | str) -> _api.BerryFlavor:
    """Get data about a berry flavor.

    Args:
        key (int | str): id or name of the berry flavor.

    Returns:
        BerryFlavor: the parsed response from the API.
    """
    return await self._get_resource("berry-flavor", key, _api.BerryFlavor)

get_contest_type(key) async

Get data about a contest type.

Parameters:

Name Type Description Default
key int | str

id or name of the contest type.

required

Returns:

Name Type Description
ContestType ContestType

the parsed response from the API.

Source code in pypokeclient/async_client.py
170
171
172
173
174
175
176
177
178
179
180
@validate_call
async def get_contest_type(self, key: int | str) -> _api.ContestType:
    """Get data about a contest type.

    Args:
        key (int | str): id or name of the contest type.

    Returns:
        ContestType: the parsed response from the API.
    """
    return await self._get_resource("contest-type", key, _api.ContestType)

get_contest_effect(key) async

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.

Source code in pypokeclient/async_client.py
182
183
184
185
186
187
188
189
190
191
192
@validate_call
async def get_contest_effect(self, key: int) -> _api.ContestEffect:
    """Get data about a contest effect.

    Args:
        key (int): id of the contest effect.

    Returns:
        ContestEffect: the parsed response from the API.
    """
    return await self._get_resource("contest-effect", key, _api.ContestEffect)

get_super_contest_effect(key) async

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.

Source code in pypokeclient/async_client.py
194
195
196
197
198
199
200
201
202
203
204
@validate_call
async def get_super_contest_effect(self, key: int) -> _api.SuperContestEffect:
    """Get data about a super contest effect.

    Args:
        key (int): id of the super contest effect.

    Returns:
        SuperContestEffect: the parsed response from the API.
    """
    return await self._get_resource("super-contest-effect", key, _api.SuperContestEffect)

get_currency(key) async

Get data about a currency.

Parameters:

Name Type Description Default
key int | str

id or name of the currency.

required

Returns:

Name Type Description
Currency Currency

the parsed response from the API.

Source code in pypokeclient/async_client.py
209
210
211
212
213
214
215
216
217
218
219
@validate_call
async def get_currency(self, key: int | str) -> _api.Currency:
    """Get data about a currency.

    Args:
        key (int | str): id or name of the currency.

    Returns:
        Currency: the parsed response from the API.
    """
    return await self._get_resource("currency", key, _api.Currency)

get_encounter_method(key) async

Get data about an encounter method.

Parameters:

Name Type Description Default
key int | str

id or name of the encounter method.

required

Returns:

Name Type Description
EncounterMethod EncounterMethod

the parsed response from the API.

Source code in pypokeclient/async_client.py
224
225
226
227
228
229
230
231
232
233
234
@validate_call
async def get_encounter_method(self, key: int | str) -> _api.EncounterMethod:
    """Get data about an encounter method.

    Args:
        key (int | str): id or name of the encounter method.

    Returns:
        EncounterMethod: the parsed response from the API.
    """
    return await self._get_resource("encounter-method", key, _api.EncounterMethod)

get_encounter_condition(key) async

Get data about an encounter condition.

Parameters:

Name Type Description Default
key int | str

id or name of the encounter condition.

required

Returns:

Name Type Description
EncounterCondition EncounterCondition

the parsed response from the API.

Source code in pypokeclient/async_client.py
236
237
238
239
240
241
242
243
244
245
246
@validate_call
async def get_encounter_condition(self, key: int | str) -> _api.EncounterCondition:
    """Get data about an encounter condition.

    Args:
        key (int | str): id or name of the encounter condition.

    Returns:
        EncounterCondition: the parsed response from the API.
    """
    return await self._get_resource("encounter-condition", key, _api.EncounterCondition)

get_encounter_condition_value(key) async

Get data about an encounter condition value.

Parameters:

Name Type Description Default
key int | str

id or name of the encounter condition.

required

Returns:

Name Type Description
EncounterConditionValue EncounterConditionValue

the parsed response from the API.

Source code in pypokeclient/async_client.py
248
249
250
251
252
253
254
255
256
257
258
@validate_call
async def get_encounter_condition_value(self, key: int | str) -> _api.EncounterConditionValue:
    """Get data about an encounter condition value.

    Args:
        key (int | str): id or name of the encounter condition.

    Returns:
        EncounterConditionValue: the parsed response from the API.
    """
    return await self._get_resource("encounter-condition-value", key, _api.EncounterConditionValue)

get_evolution_chain(key) async

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.

Source code in pypokeclient/async_client.py
263
264
265
266
267
268
269
270
271
272
273
@validate_call
async def get_evolution_chain(self, key: int) -> _api.EvolutionChain:
    """Get data about an evolution chain.

    Args:
        key (int): id of the evolution chain.

    Returns:
        EvolutionChain: the parsed response from the API.
    """
    return await self._get_resource("evolution-chain", key, _api.EvolutionChain)

get_evolution_trigger(key) async

Get data about an evolution trigger.

Parameters:

Name Type Description Default
key int | str

id or name of the evolution trigger.

required

Returns:

Name Type Description
EvolutionTrigger EvolutionTrigger

the parsed response from the API.

Source code in pypokeclient/async_client.py
275
276
277
278
279
280
281
282
283
284
285
@validate_call
async def get_evolution_trigger(self, key: int | str) -> _api.EvolutionTrigger:
    """Get data about an evolution trigger.

    Args:
        key (int | str): id or name of the evolution trigger.

    Returns:
        EvolutionTrigger: the parsed response from the API.
    """
    return await self._get_resource("evolution-trigger", key, _api.EvolutionTrigger)

get_evolution_variable(key) async

Get data about an evolution variable.

Parameters:

Name Type Description Default
key int | str

id or name of the evolution variable.

required

Returns:

Name Type Description
EvolutionVariable EvolutionVariable

the parsed response from the API.

Source code in pypokeclient/async_client.py
287
288
289
290
291
292
293
294
295
296
297
@validate_call
async def get_evolution_variable(self, key: int | str) -> _api.EvolutionVariable:
    """Get data about an evolution variable.

    Args:
        key (int | str): id or name of the evolution variable.

    Returns:
        EvolutionVariable: the parsed response from the API.
    """
    return await self._get_resource("evolution-variable", key, _api.EvolutionVariable)

get_generation(key) async

Get data about a generation.

Parameters:

Name Type Description Default
key int | str

id or name of the generation.

required

Returns:

Name Type Description
Generation Generation

the parsed response from the API.

Source code in pypokeclient/async_client.py
302
303
304
305
306
307
308
309
310
311
312
@validate_call
async def get_generation(self, key: int | str) -> _api.Generation:
    """Get data about a generation.

    Args:
        key (int | str): id or name of the generation.

    Returns:
        Generation: the parsed response from the API.
    """
    return await self._get_resource("generation", key, _api.Generation)

get_pokedex(key) async

Get data about a Pokédex.

Parameters:

Name Type Description Default
key int | str

id or name of the Pokédex.

required

Returns:

Name Type Description
Pokedex Pokedex

the parsed response from the API.

Source code in pypokeclient/async_client.py
314
315
316
317
318
319
320
321
322
323
324
@validate_call
async def get_pokedex(self, key: int | str) -> _api.Pokedex:
    """Get data about a Pokédex.

    Args:
        key (int | str): id or name of the Pokédex.

    Returns:
        Pokedex: the parsed response from the API.
    """
    return await self._get_resource("pokedex", key, _api.Pokedex)

get_version_group(key) async

Get data about a version group.

Parameters:

Name Type Description Default
key int | str

id or name of the version group.

required

Returns:

Name Type Description
VersionGroup VersionGroup

the parsed response from the API.

Source code in pypokeclient/async_client.py
326
327
328
329
330
331
332
333
334
335
336
@validate_call
async def get_version_group(self, key: int | str) -> _api.VersionGroup:
    """Get data about a version group.

    Args:
        key (int | str): id or name of the version group.

    Returns:
        VersionGroup: the parsed response from the API.
    """
    return await self._get_resource("version-group", key, _api.VersionGroup)

get_version(key) async

Get data about a version.

Parameters:

Name Type Description Default
key int | str

id or name of the version.

required

Returns:

Name Type Description
Version Version

the parsed response from the API.

Source code in pypokeclient/async_client.py
338
339
340
341
342
343
344
345
346
347
348
@validate_call
async def get_version(self, key: int | str) -> _api.Version:
    """Get data about a version.

    Args:
        key (int | str): id or name of the version.

    Returns:
        Version: the parsed response from the API.
    """
    return await self._get_resource("version", key, _api.Version)

get_item(key) async

Get data about an item.

Parameters:

Name Type Description Default
key int | str

id or name of the item.

required

Returns:

Name Type Description
Item Item

the parsed response from the API.

Source code in pypokeclient/async_client.py
353
354
355
356
357
358
359
360
361
362
363
@validate_call
async def get_item(self, key: int | str) -> _api.Item:
    """Get data about an item.

    Args:
        key (int | str): id or name of the item.

    Returns:
        Item: the parsed response from the API.
    """
    return await self._get_resource("item", key, _api.Item)

get_item_attribute(key) async

Get data about an item attribute.

Parameters:

Name Type Description Default
key int | str

id or name of the item attribute.

required

Returns:

Name Type Description
ItemAttribute ItemAttribute

the parsed response from the API.

Source code in pypokeclient/async_client.py
365
366
367
368
369
370
371
372
373
374
375
@validate_call
async def get_item_attribute(self, key: int | str) -> _api.ItemAttribute:
    """Get data about an item attribute.

    Args:
        key (int | str): id or name of the item attribute.

    Returns:
        ItemAttribute: the parsed response from the API.
    """
    return await self._get_resource("item-attribute", key, _api.ItemAttribute)

get_item_category(key) async

Get data about an item category.

Parameters:

Name Type Description Default
key int | str

id or name of the item category.

required

Returns:

Name Type Description
ItemCategory ItemCategory

the parsed response from the API.

Source code in pypokeclient/async_client.py
377
378
379
380
381
382
383
384
385
386
387
@validate_call
async def get_item_category(self, key: int | str) -> _api.ItemCategory:
    """Get data about an item category.

    Args:
        key (int | str): id or name of the item category.

    Returns:
        ItemCategory: the parsed response from the API.
    """
    return await self._get_resource("item-category", key, _api.ItemCategory)

get_item_fling_effect(key) async

Get data about an item fling effect.

Parameters:

Name Type Description Default
key int | str

id or name of the item fling effect.

required

Returns:

Name Type Description
ItemFlingEffect ItemFlingEffect

the parsed response from the API.

Source code in pypokeclient/async_client.py
389
390
391
392
393
394
395
396
397
398
399
@validate_call
async def get_item_fling_effect(self, key: int | str) -> _api.ItemFlingEffect:
    """Get data about an item fling effect.

    Args:
        key (int | str): id or name of the item fling effect.

    Returns:
        ItemFlingEffect: the parsed response from the API.
    """
    return await self._get_resource("item-fling-effect", key, _api.ItemFlingEffect)

get_item_pocket(key) async

Get data about an item pocket.

Parameters:

Name Type Description Default
key int | str

id or name of the item pocket.

required

Returns:

Name Type Description
ItemPocket ItemPocket

the parsed response from the API.

Source code in pypokeclient/async_client.py
401
402
403
404
405
406
407
408
409
410
411
@validate_call
async def get_item_pocket(self, key: int | str) -> _api.ItemPocket:
    """Get data about an item pocket.

    Args:
        key (int | str): id or name of the item pocket.

    Returns:
        ItemPocket: the parsed response from the API.
    """
    return await self._get_resource("item-pocket", key, _api.ItemPocket)

get_location(key) async

Get data about a location.

Parameters:

Name Type Description Default
key int | str

id or name of the location.

required

Returns:

Name Type Description
Location Location

the parsed response from the API.

Source code in pypokeclient/async_client.py
416
417
418
419
420
421
422
423
424
425
426
@validate_call
async def get_location(self, key: int | str) -> _api.Location:
    """Get data about a location.

    Args:
        key (int | str): id or name of the location.

    Returns:
        Location: the parsed response from the API.
    """
    return await self._get_resource("location", key, _api.Location)

get_location_area(key) async

Get data about a location area.

Parameters:

Name Type Description Default
key int | str

id or name of the location area.

required

Returns:

Name Type Description
LocationArea LocationArea

the parsed response from the API.

Source code in pypokeclient/async_client.py
428
429
430
431
432
433
434
435
436
437
438
@validate_call
async def get_location_area(self, key: int | str) -> _api.LocationArea:
    """Get data about a location area.

    Args:
        key (int | str): id or name of the location area.

    Returns:
        LocationArea: the parsed response from the API.
    """
    return await self._get_resource("location-area", key, _api.LocationArea)

get_pal_park_area(key) async

Get data about a Pal Park area.

Parameters:

Name Type Description Default
key int | str

id or name of the Pal Park area.

required

Returns:

Name Type Description
PalParkArea PalParkArea

the parsed response from the API.

Source code in pypokeclient/async_client.py
440
441
442
443
444
445
446
447
448
449
450
@validate_call
async def get_pal_park_area(self, key: int | str) -> _api.PalParkArea:
    """Get data about a Pal Park area.

    Args:
        key (int | str): id or name of the Pal Park area.

    Returns:
        PalParkArea: the parsed response from the API.
    """
    return await self._get_resource("pal-park-area", key, _api.PalParkArea)

get_region(key) async

Get data about a region.

Parameters:

Name Type Description Default
key int | str

id or name of the region.

required

Returns:

Name Type Description
Region Region

the parsed response from the API.

Source code in pypokeclient/async_client.py
452
453
454
455
456
457
458
459
460
461
462
@validate_call
async def get_region(self, key: int | str) -> _api.Region:
    """Get data about a region.

    Args:
        key (int | str): id or name of the region.

    Returns:
        Region: the parsed response from the API.
    """
    return await self._get_resource("region", key, _api.Region)

get_machine(key) async

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.

Source code in pypokeclient/async_client.py
467
468
469
470
471
472
473
474
475
476
477
@validate_call
async def get_machine(self, key: int) -> _api.Machine:
    """Get data about a machine.

    Args:
        key (int): id of the machine.

    Returns:
        Machine: the parsed response from the API.
    """
    return await self._get_resource("machine", key, _api.Machine)

get_move(key) async

Get data about a move.

Parameters:

Name Type Description Default
key int | str

id or name of the move.

required

Returns:

Name Type Description
Move Move

the parsed response from the API.

Source code in pypokeclient/async_client.py
482
483
484
485
486
487
488
489
490
491
492
@validate_call
async def get_move(self, key: int | str) -> _api.Move:
    """Get data about a move.

    Args:
        key (int | str): id or name of the move.

    Returns:
        Move: the parsed response from the API.
    """
    return await self._get_resource("move", key, _api.Move)

get_move_ailment(key) async

Get data about a move ailment.

Parameters:

Name Type Description Default
key int | str

id or name of the move ailment.

required

Returns:

Name Type Description
MoveAilment MoveAilment

the parsed response from the API.

Source code in pypokeclient/async_client.py
494
495
496
497
498
499
500
501
502
503
504
@validate_call
async def get_move_ailment(self, key: int | str) -> _api.MoveAilment:
    """Get data about a move ailment.

    Args:
        key (int | str): id or name of the move ailment.

    Returns:
        MoveAilment: the parsed response from the API.
    """
    return await self._get_resource("move-ailment", key, _api.MoveAilment)

get_move_battle_style(key) async

Get data about a move battle style.

Parameters:

Name Type Description Default
key int | str

id or name of the move battle style.

required

Returns:

Name Type Description
MoveBattleStyle MoveBattleStyle

the parsed response from the API.

Source code in pypokeclient/async_client.py
506
507
508
509
510
511
512
513
514
515
516
@validate_call
async def get_move_battle_style(self, key: int | str) -> _api.MoveBattleStyle:
    """Get data about a move battle style.

    Args:
        key (int | str): id or name of the move battle style.

    Returns:
        MoveBattleStyle: the parsed response from the API.
    """
    return await self._get_resource("move-battle-style", key, _api.MoveBattleStyle)

get_move_category(key) async

Get data about a move category.

Parameters:

Name Type Description Default
key int | str

id or name of the move category.

required

Returns:

Name Type Description
MoveCategory MoveCategory

the parsed response from the API.

Source code in pypokeclient/async_client.py
518
519
520
521
522
523
524
525
526
527
528
@validate_call
async def get_move_category(self, key: int | str) -> _api.MoveCategory:
    """Get data about a move category.

    Args:
        key (int | str): id or name of the move category.

    Returns:
        MoveCategory: the parsed response from the API.
    """
    return await self._get_resource("move-category", key, _api.MoveCategory)

get_damage_class(key) async

Get data about a move damage class.

Parameters:

Name Type Description Default
key int | str

id or name of the move damage class.

required

Returns:

Name Type Description
MoveDamageClass MoveDamageClass

the parsed response from the API.

Source code in pypokeclient/async_client.py
530
531
532
533
534
535
536
537
538
539
540
@validate_call
async def get_damage_class(self, key: int | str) -> _api.MoveDamageClass:
    """Get data about a move damage class.

    Args:
        key (int | str): id or name of the move damage class.

    Returns:
        MoveDamageClass: the parsed response from the API.
    """
    return await self._get_resource("move-damage-class", key, _api.MoveDamageClass)

get_move_learn_method(key) async

Get data about a move learn method.

Parameters:

Name Type Description Default
key int | str

id or name of the move learn method.

required

Returns:

Name Type Description
MoveLearnMethod MoveLearnMethod

the parsed response from the API.

Source code in pypokeclient/async_client.py
542
543
544
545
546
547
548
549
550
551
552
@validate_call
async def get_move_learn_method(self, key: int | str) -> _api.MoveLearnMethod:
    """Get data about a move learn method.

    Args:
        key (int | str): id or name of the move learn method.

    Returns:
        MoveLearnMethod: the parsed response from the API.
    """
    return await self._get_resource("move-learn-method", key, _api.MoveLearnMethod)

get_move_target(key) async

Get data about a move target.

Parameters:

Name Type Description Default
key int | str

id or name of the move target.

required

Returns:

Name Type Description
MoveTarget MoveTarget

the parsed response from the API.

Source code in pypokeclient/async_client.py
554
555
556
557
558
559
560
561
562
563
564
@validate_call
async def get_move_target(self, key: int | str) -> _api.MoveTarget:
    """Get data about a move target.

    Args:
        key (int | str): id or name of the move target.

    Returns:
        MoveTarget: the parsed response from the API.
    """
    return await self._get_resource("move-target", key, _api.MoveTarget)

get_ability(key) async

Get data about an ability.

Parameters:

Name Type Description Default
key int | str

id or name of the ability.

required

Returns:

Name Type Description
Ability Ability

the parsed response from the API.

Source code in pypokeclient/async_client.py
569
570
571
572
573
574
575
576
577
578
579
@validate_call
async def get_ability(self, key: int | str) -> _api.Ability:
    """Get data about an ability.

    Args:
        key (int | str): id or name of the ability.

    Returns:
        Ability: the parsed response from the API.
    """
    return await self._get_resource("ability", key, _api.Ability)

get_characteristic(key) async

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.

Source code in pypokeclient/async_client.py
581
582
583
584
585
586
587
588
589
590
591
@validate_call
async def get_characteristic(self, key: int) -> _api.Characteristic:
    """Get data about a characteristic.

    Args:
        key (int): id of the characteristic.

    Returns:
        Characteristic: the parsed response from the API.
    """
    return await self._get_resource("characteristic", key, _api.Characteristic)

get_egg_group(key) async

Get data about an egg group.

Parameters:

Name Type Description Default
key int | str

id or name of the egg group.

required

Returns:

Name Type Description
EggGroup EggGroup

the parsed response from the API.

Source code in pypokeclient/async_client.py
593
594
595
596
597
598
599
600
601
602
603
@validate_call
async def get_egg_group(self, key: int | str) -> _api.EggGroup:
    """Get data about an egg group.

    Args:
        key (int | str): id or name of the egg group.

    Returns:
        EggGroup: the parsed response from the API.
    """
    return await self._get_resource("egg-group", key, _api.EggGroup)

get_gender(key) async

Get data about a gender.

Parameters:

Name Type Description Default
key int | str

id or name of the gender.

required

Returns:

Name Type Description
Gender Gender

the parsed response from the API.

Source code in pypokeclient/async_client.py
605
606
607
608
609
610
611
612
613
614
615
@validate_call
async def get_gender(self, key: int | str) -> _api.Gender:
    """Get data about a gender.

    Args:
        key (int | str): id or name of the gender.

    Returns:
        Gender: the parsed response from the API.
    """
    return await self._get_resource("gender", key, _api.Gender)

get_growth_rate(key) async

Get data about a growth rate.

Parameters:

Name Type Description Default
key int | str

id or name of the growth rate.

required

Returns:

Name Type Description
GrowthRate GrowthRate

the parsed response from the API.

Source code in pypokeclient/async_client.py
617
618
619
620
621
622
623
624
625
626
627
@validate_call
async def get_growth_rate(self, key: int | str) -> _api.GrowthRate:
    """Get data about a growth rate.

    Args:
        key (int | str): id or name of the growth rate.

    Returns:
        GrowthRate: the parsed response from the API.
    """
    return await self._get_resource("growth-rate", key, _api.GrowthRate)

get_nature(key) async

Get data about a nature.

Parameters:

Name Type Description Default
key int | str

id or name of the nature.

required

Returns:

Name Type Description
Nature Nature

the parsed response from the API.

Source code in pypokeclient/async_client.py
629
630
631
632
633
634
635
636
637
638
639
@validate_call
async def get_nature(self, key: int | str) -> _api.Nature:
    """Get data about a nature.

    Args:
        key (int | str): id or name of the nature.

    Returns:
        Nature: the parsed response from the API.
    """
    return await self._get_resource("nature", key, _api.Nature)

get_pokeathlon_stat(key) async

Get data about a Pokéathlon stat.

Parameters:

Name Type Description Default
key int | str

id or name of the Pokéathlon stat.

required

Returns:

Name Type Description
PokeathlonStat PokeathlonStat

the parsed response from the API.

Source code in pypokeclient/async_client.py
641
642
643
644
645
646
647
648
649
650
651
@validate_call
async def get_pokeathlon_stat(self, key: int | str) -> _api.PokeathlonStat:
    """Get data about a Pokéathlon stat.

    Args:
        key (int | str): id or name of the Pokéathlon stat.

    Returns:
        PokeathlonStat: the parsed response from the API.
    """
    return await self._get_resource("pokeathlon-stat", key, _api.PokeathlonStat)

get_pokemon(key) async

Get data about a pokémon.

Parameters:

Name Type Description Default
key int | str

id or name of the pokémon

required

Returns:

Name Type Description
Pokemon Pokemon

the parsed response from the API.

Source code in pypokeclient/async_client.py
653
654
655
656
657
658
659
660
661
662
663
@validate_call
async def get_pokemon(self, key: int | str) -> _api.Pokemon:
    """Get data about a pokémon.

    Args:
        key (int | str): id or name of the pokémon

    Returns:
        Pokemon: the parsed response from the API.
    """
    return await self._get_resource("pokemon", key, _api.Pokemon)

get_pokemon_location_area(key) async

Get data about a Pokémon's encounters in a location area.

Parameters:

Name Type Description Default
key int | str

id or name of the Pokémon.

required

Returns:

Name Type Description
LocationAreaEncounter list[LocationAreaEncounter]

the parsed response from the API.

Source code in pypokeclient/async_client.py
665
666
667
668
669
670
671
672
673
674
675
@validate_call
async def get_pokemon_location_area(self, key: int | str) -> list[_api.LocationAreaEncounter]:
    """Get data about a Pokémon's encounters in a location area.

    Args:
        key (int | str): id or name of the Pokémon.

    Returns:
        LocationAreaEncounter: the parsed response from the API.
    """
    return await self._get_resources(f"pokemon/{key}/encounters", "", _api.LocationAreaEncounter)

get_pokemon_color(key) async

Get data about a Pokémon color.

Parameters:

Name Type Description Default
key int | str

id or name of the Pokémon color.

required

Returns:

Name Type Description
PokemonColor PokemonColor

the parsed response from the API.

Source code in pypokeclient/async_client.py
677
678
679
680
681
682
683
684
685
686
687
@validate_call
async def get_pokemon_color(self, key: int | str) -> _api.PokemonColor:
    """Get data about a Pokémon color.

    Args:
        key (int | str): id or name of the Pokémon color.

    Returns:
        PokemonColor: the parsed response from the API.
    """
    return await self._get_resource("pokemon-color", key, _api.PokemonColor)

get_pokemon_form(key) async

Get data about a Pokémon form.

Parameters:

Name Type Description Default
key int | str

id or name of the Pokémon form.

required

Returns:

Name Type Description
PokemonForm PokemonForm

the parsed response from the API.

Source code in pypokeclient/async_client.py
689
690
691
692
693
694
695
696
697
698
699
@validate_call
async def get_pokemon_form(self, key: int | str) -> _api.PokemonForm:
    """Get data about a Pokémon form.

    Args:
        key (int | str): id or name of the Pokémon form.

    Returns:
        PokemonForm: the parsed response from the API.
    """
    return await self._get_resource("pokemon-form", key, _api.PokemonForm)

get_pokemon_habitat(key) async

Get data about a Pokémon habitat.

Parameters:

Name Type Description Default
key int | str

id or name of the Pokémon habitat.

required

Returns:

Name Type Description
PokemonHabitat PokemonHabitat

the parsed response from the API.

Source code in pypokeclient/async_client.py
701
702
703
704
705
706
707
708
709
710
711
@validate_call
async def get_pokemon_habitat(self, key: int | str) -> _api.PokemonHabitat:
    """Get data about a Pokémon habitat.

    Args:
        key (int | str): id or name of the Pokémon habitat.

    Returns:
        PokemonHabitat: the parsed response from the API.
    """
    return await self._get_resource("pokemon-habitat", key, _api.PokemonHabitat)

get_pokemon_shape(key) async

Get data about a Pokémon shape.

Parameters:

Name Type Description Default
key int | str

id or name of the Pokémon shape.

required

Returns:

Name Type Description
PokemonShape PokemonShape

the parsed response from the API.

Source code in pypokeclient/async_client.py
713
714
715
716
717
718
719
720
721
722
723
@validate_call
async def get_pokemon_shape(self, key: int | str) -> _api.PokemonShape:
    """Get data about a Pokémon shape.

    Args:
        key (int | str): id or name of the Pokémon shape.

    Returns:
        PokemonShape: the parsed response from the API.
    """
    return await self._get_resource("pokemon-shape", key, _api.PokemonShape)

get_pokemon_species(key) async

Get data about a Pokémon species.

Parameters:

Name Type Description Default
key int | str

id or name of the Pokémon species.

required

Returns:

Name Type Description
PokemonSpecies PokemonSpecies

the parsed response from the API.

Source code in pypokeclient/async_client.py
725
726
727
728
729
730
731
732
733
734
735
@validate_call
async def get_pokemon_species(self, key: int | str) -> _api.PokemonSpecies:
    """Get data about a Pokémon species.

    Args:
        key (int | str): id or name of the Pokémon species.

    Returns:
        PokemonSpecies: the parsed response from the API.
    """
    return await self._get_resource("pokemon-species", key, _api.PokemonSpecies)

get_stat(key) async

Get data about a stat.

Parameters:

Name Type Description Default
key int | str

id or name of the stat.

required

Returns:

Name Type Description
Stat Stat

the parsed response from the API.

Source code in pypokeclient/async_client.py
737
738
739
740
741
742
743
744
745
746
747
@validate_call
async def get_stat(self, key: int | str) -> _api.Stat:
    """Get data about a stat.

    Args:
        key (int | str): id or name of the stat.

    Returns:
        Stat: the parsed response from the API.
    """
    return await self._get_resource("stat", key, _api.Stat)

get_type(key) async

Get data about a type.

Parameters:

Name Type Description Default
key int | str

id or name of the type.

required

Returns:

Name Type Description
Type Type

the parsed response from the API.

Source code in pypokeclient/async_client.py
749
750
751
752
753
754
755
756
757
758
759
@validate_call
async def get_type(self, key: int | str) -> _api.Type:
    """Get data about a type.

    Args:
        key (int | str): id or name of the type.

    Returns:
        Type: the parsed response from the API.
    """
    return await self._get_resource("type", key, _api.Type)

get_language(key) async

Get infos about a language.

Parameters:

Name Type Description Default
key int | str

id or name of the pokémon

required

Returns:

Name Type Description
Language Language

the parsed response from the API.

Source code in pypokeclient/async_client.py
764
765
766
767
768
769
770
771
772
773
774
@validate_call
async def get_language(self, key: int | str) -> _api.Language:
    """Get infos about a language.

    Args:
        key (int | str): id or name of the pokémon

    Returns:
        Language: the parsed response from the API.
    """
    return await self._get_resource("language", key, _api.Language)

get_sprite(url) async

Get a sprite from an url.

Parameters:

Name Type Description Default
url str

the url to the sprite.

required

Returns:

Name Type Description
Sprite Sprite

a Sprite object useful to save the image.

Source code in pypokeclient/async_client.py
779
780
781
782
783
784
785
786
787
788
789
790
@validate_call
async def get_sprite(self, url: str) -> _api.Sprite:
    """Get a sprite from an url.

    Args:
        url (str): the url to the sprite.

    Returns:
        Sprite: a Sprite object useful to save the image.
    """
    response = await self._api_request(url)
    return _api.Sprite(url, response.content)