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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pokelance-0.2.15.tar.gz
(57.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pokelance-0.2.15.tar.gz.
File metadata
- Download URL: pokelance-0.2.15.tar.gz
- Upload date:
- Size: 57.8 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40a6abe8e06161b3d3fe6dcaf1d933c32bd8f2a6f1b1a938b3889590f80f6f35
|
|
| MD5 |
220fa5ca3b2a0d2def4fe5847bb38d5a
|
|
| BLAKE2b-256 |
297d53377578d72f1ab9b742572c63d84c60e06ab07d5d3460309dc08f34dfd2
|
File details
Details for the file pokelance-0.2.15-py3-none-any.whl.
File metadata
- Download URL: pokelance-0.2.15-py3-none-any.whl
- Upload date:
- Size: 83.4 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4fc37efacd1cd52d9c6b0f3269dcac67940904d0ca8e7e30ce2c09002eae4e4e
|
|
| MD5 |
1f2f9623c3f2c9ae4d23feba77266c6a
|
|
| BLAKE2b-256 |
fa19b3c1515141c4f69e184161dbbbdd9ba444d30d5b4d895bc2a19e47e1e45b
|