PokeLance
A flexible, statically typed and easy to use pokeapi wrapper for python 🚀
Features:
- Modern and pythonic API asynchronously built on top of aiohttp
- Flexible and easy to use
- Fully typed with mypy
- Linted with ruff
- Well documented
- Optimized for speed and performance
- Automatically caches data for faster access
- Caches endpoints for user convenience
Installation
$ python -m pip install PokeLance
Usage
import asyncio
from pokelance import PokeLance
client = PokeLance() # Create a client instance
async def main() -> None:
print(await client.ping()) # Ping the pokeapi
print(await client.berry.fetch_berry("cheri")) # Fetch a berry from the pokeapi
print(await client.berry.fetch_berry_flavor("spicy"))
print(await client.berry.fetch_berry_firmness("very-soft"))
print(client.berry.get_berry("cheri")) # Get a cached berry it will return None if it doesn't exist
print(client.berry.get_berry_flavor("spicy"))
print(client.berry.get_berry_firmness("very-soft"))
await client.close() # Close the client
return None
asyncio.run(main())
With Async Context Manager
import asyncio
import aiohttp
from pokelance import PokeLance
async def main() -> None:
# Use an async context manager to create a client instance
async with aiohttp.ClientSession() as session, PokeLance(session=session) as client:
print(await client.ping()) # Ping the pokeapi
print(await client.berry.fetch_berry("cheri")) # Fetch a berry from the pokeapi
print(await client.berry.fetch_berry_flavor("spicy"))
print(await client.berry.fetch_berry_firmness("very-soft"))
print(client.berry.get_berry("cheri")) # Get a cached berry it will return None if it doesn't exist
print(client.berry.get_berry_flavor("spicy"))
print(client.berry.get_berry_firmness("very-soft"))
# The client will be closed automatically when the async context manager exits
return None
asyncio.run(main())
Documentation
- Getting Started
- Quickstart
- Fetching Data
- Caching In Depth
- Error Handling
- Media - Sprites & Cries
- API Reference
Recipes
Links
Metadata
Release files for pokelance 0.2.17
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pokelance-0.2.17.tar.gz | 59.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pokelance-0.2.17-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 143.7 kB
Release files / pokelance-0.2.17.tar.gz
| Download URL | pokelance-0.2.17.tar.gz |
|---|---|
| Size | 59.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
738e4269e9edbeddc079bf147c67e5edc442f4241eff1fad14e6c660fdf462a3
|
|
BLAKE2b-256 checksum How to use checksums |
50d1fec90e69ea1e9442115c3e19e884c5600273e7c6423c87ba3c15a34b1c39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / pokelance-0.2.17-py3-none-any.whl
| Download URL | pokelance-0.2.17-py3-none-any.whl |
|---|---|
| Size | 84.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8264d17672b2a72ce5663c4b307793dca179e9d2fa4e73d450cc05e1662861b6
|
|
BLAKE2b-256 checksum How to use checksums |
c84acb5cc6a73ffd1f3335184c2ab2e95792a3ef2251a4d210c6652aa05afb80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|