A flexible and easy to use pokemon library.
Project description
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
- Statically 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())
Important Links
- PokeAPI
- PokeAPI Documentation
- PokeLance Documentation
- PokeLance ReadTheDocs
- PokeLance GitHub
- PokeLance PyPI
- PokeLance Discord
!!! note "Note" This is a work in progress. If you find any bugs or have any suggestions, please open an issue here.
Project details
Release history Release notifications | RSS feed
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.0.8a0.tar.gz
(50.7 kB
view details)
Built Distribution
File details
Details for the file pokelance-0.0.8a0.tar.gz
.
File metadata
- Download URL: pokelance-0.0.8a0.tar.gz
- Upload date:
- Size: 50.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.1 CPython/3.10.8 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e856b3de6472c37f46772f149f54baa758cdf7a97de262d7067e6392e1241877 |
|
MD5 | 7480ad029a6a175de58c3fdc42d72cb8 |
|
BLAKE2b-256 | eff5d74e762deb7a98e1820dc5415707edd9dcf387f0a3075bc174181eeea433 |
File details
Details for the file pokelance-0.0.8a0-py3-none-any.whl
.
File metadata
- Download URL: pokelance-0.0.8a0-py3-none-any.whl
- Upload date:
- Size: 73.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.1 CPython/3.10.8 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 929c96ba485c305c2daad0fd74def4938e9f54e41e6eee732a32a4a5e02ade6e |
|
MD5 | 5695b4b2a537bbecc8f6802ebfc489bb |
|
BLAKE2b-256 | 618c6a1e552b4e69764e04e4e95ea569618be305dbd35d69d0d7ded46e74d934 |