📌 Features
- Coverage: covers all PokéAPI endpoints.
- Data validation: uses Pydantic dataclasses to model and validate API responses.
- Flexibility: provides both synchronous and asynchronous clients.
- Caching: supports an optional local caching system for faster responses and to help comply with PokéAPI's Fair Use Policy.
Please refer to the documentation for more details about the package.
📦 Installation
# It is highly recommended to use uv
uv add pypokeclient
# You can also install the package with pip
pip install pypokeclient
🛠️ How to use
You can choose between the synchronous and asynchronous clients.
Sync
from pypokeclient import Client
# Simple usage
client = Client()
pokemon = client.get_pokemon("fuecoco")
# Or with context manager
with Client() as client:
pokemon = client.get_pokemon("fuecoco")
Async
import asyncio
from pypokeclient import AsyncClient
async def fetch_data():
# Simple usage
client = AsyncClient()
pokemon = await client.get_pokemon("fuecoco")
# With context manager
async with AsyncClient() as client:
pokemon = await client.get_pokemon("fuecoco")
asyncio.run(fetch_data())
No client
If you want to build your own client, including the caching mechanism, while still benefiting from Pydantic dataclasses, you can use the data models directly.
import requests
from pypokeclient._api import Pokemon
resp = requests.get("https://pokeapi.co/api/v2/pokemon/fuecoco")
pokemon = Pokemon(**resp.json())
💾 Caching the results
[!IMPORTANT] Please refer to the hishel documentation for more details about the caching system.
import logging
from hishel import SyncSqliteStorage
from hishel.httpx import SyncCacheClient
from pypokeclient import Client
# Set up the logger
logger = logging.getLogger("pypokeclient")
logger.setLevel(logging.INFO)
console_handler = logging.StreamHandler()
console_handler.setFormatter(logging.Formatter("%(name)s - %(levelname)s - %(message)s"))
logger.addHandler(console_handler)
# Set up the underlying HTTP client
http_client = SyncCacheClient(storage=SyncSqliteStorage(database_path="pypokeclient_cache.db"))
# Fetch data
with Client(http_client) as sync_client:
pokemon = sync_client.get_pokemon("fuecoco")
pokemon = sync_client.get_pokemon("fuecoco")
# The sprites are cached too
sprite = sync_client.get_sprite(pokemon.sprites.front_default)
sprite = sync_client.get_sprite(pokemon.sprites.front_default)
# You can also save the sprites locally if needed
sprite.save("fuecoco.png")
The output will be
pypokeclient - INFO - The synchronous client is ready and using the cache at .cache\hishel\pypokeclient_cache.db'.
pypokeclient - INFO - [200] Request to https://pokeapi.co/api/v2/pokemon/fuecoco.
pypokeclient - INFO - [200] Cached request to https://pokeapi.co/api/v2/pokemon/fuecoco.
pypokeclient - INFO - [200] Request to https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/909.png.
pypokeclient - INFO - [200] Cached request to https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/909.png.
pypokeclient - INFO - Closed session for the synchronous client.
📝 License
This project is MIT licensed.
Metadata
Release files for pypokeclient 2.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pypokeclient-2.4.0.tar.gz | 602.6 kB | With provenance | Details for pypokeclient-2.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pypokeclient-2.4.0-py3-none-any.whl | Python 3 | none | any | Details for pypokeclient-2.4.0-py3-none-any.whl |
Total release size: 643.4 kB
Release files / pypokeclient-2.4.0.tar.gz
| Download URL | pypokeclient-2.4.0.tar.gz |
|---|---|
| Size | 602.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1bb3e9d751b32ca40d8246f3f707cb9bce9eef49a5f3ad371e2f82469291903
|
|
BLAKE2b-256 checksum How to use checksums |
adae074df5f969eefc7795d46ed39b0804e5662ffec5baa197748ea15dd5f3b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.
Transparency logRelease files / pypokeclient-2.4.0-py3-none-any.whl
| Download URL | pypokeclient-2.4.0-py3-none-any.whl |
|---|---|
| Size | 40.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9e37ca869b95a790240af629e3631cfc136d96afdd66810bb0b49351ef231893
|
|
BLAKE2b-256 checksum How to use checksums |
54ec3e7ebc1707f58b3d69cb9017fd7b24a49f2e4861a0dac41a5bcfd17c72ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.
Transparency logSecurity for pypokeclient 2.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pypokeclient-2.4.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.