pokelance 0.2.7

Last updated:

0 purchases

pokelance 0.2.7 Image
pokelance 0.2.7 Images
Add to Cart

Description:

pokelance 0.2.7

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())

Examples
Examples
Following examples are available open an issue if you want more examples or more details on certain examples.

Basic Usage
Advanced cache usage
Discord bot example
FastAPI example

Important Links

PokeAPI
PokeAPI Documentation
PokeLance Documentation
PokeLance ReadTheDocs
PokeLance GitHub
PokeLance PyPI
PokeLance Discord

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.