AsyncClient class¶
Here's the reference information for the AsyncClient class.
You can import the AsyncClient class directly from pypokeclient:
from pypokeclient import AsyncClient
Asynchronous version of the client.
Initializes an AsyncClient object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
http_client
|
AsyncClient
|
an |
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 | |
__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 | |
__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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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
209 210 211 212 213 214 215 216 217 218 219 | |
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
221 222 223 224 225 226 227 228 229 230 231 | |
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
233 234 235 236 237 238 239 240 241 242 243 | |
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
248 249 250 251 252 253 254 255 256 257 258 | |
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
260 261 262 263 264 265 266 267 268 269 270 | |
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
275 276 277 278 279 280 281 282 283 284 285 | |
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
287 288 289 290 291 292 293 294 295 296 297 | |
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
299 300 301 302 303 304 305 306 307 308 309 | |
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
311 312 313 314 315 316 317 318 319 320 321 | |
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
326 327 328 329 330 331 332 333 334 335 336 | |
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
338 339 340 341 342 343 344 345 346 347 348 | |
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
350 351 352 353 354 355 356 357 358 359 360 | |
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
362 363 364 365 366 367 368 369 370 371 372 | |
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
374 375 376 377 378 379 380 381 382 383 384 | |
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
389 390 391 392 393 394 395 396 397 398 399 | |
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
401 402 403 404 405 406 407 408 409 410 411 | |
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
413 414 415 416 417 418 419 420 421 422 423 | |
get_regions(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
425 426 427 428 429 430 431 432 433 434 435 | |
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
440 441 442 443 444 445 446 447 448 449 450 | |
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
455 456 457 458 459 460 461 462 463 464 465 | |
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
467 468 469 470 471 472 473 474 475 476 477 | |
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
479 480 481 482 483 484 485 486 487 488 489 | |
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
491 492 493 494 495 496 497 498 499 500 501 | |
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
503 504 505 506 507 508 509 510 511 512 513 | |
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
515 516 517 518 519 520 521 522 523 524 525 | |
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
527 528 529 530 531 532 533 534 535 536 537 | |
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
542 543 544 545 546 547 548 549 550 551 552 | |
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
554 555 556 557 558 559 560 561 562 563 564 | |
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
566 567 568 569 570 571 572 573 574 575 576 | |
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
578 579 580 581 582 583 584 585 586 587 588 | |
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
590 591 592 593 594 595 596 597 598 599 600 | |
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
602 603 604 605 606 607 608 609 610 611 612 | |
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
614 615 616 617 618 619 620 621 622 623 624 | |
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
626 627 628 629 630 631 632 633 634 635 636 | |
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
638 639 640 641 642 643 644 645 646 647 648 | |
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
650 651 652 653 654 655 656 657 658 659 660 | |
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
662 663 664 665 666 667 668 669 670 671 672 | |
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
674 675 676 677 678 679 680 681 682 683 684 | |
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
686 687 688 689 690 691 692 693 694 695 696 | |
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
698 699 700 701 702 703 704 705 706 707 708 | |
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
710 711 712 713 714 715 716 717 718 719 720 | |
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
722 723 724 725 726 727 728 729 730 731 732 | |
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
737 738 739 740 741 742 743 744 745 746 747 | |
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
752 753 754 755 756 757 758 759 760 761 762 763 | |