Skip to main content

A flexible and easy to use pokemon library.

Project description

PokeLance

logo

license black mypy ruff stars commits py versions

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


!!! note "Note" This is a work in progress. If you find any bugs or have any suggestions, please open an issue here.


Project details


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.18a0.tar.gz (49.2 kB view details)

Uploaded Source

Built Distribution

pokelance-0.0.18a0-py3-none-any.whl (71.7 kB view details)

Uploaded Python 3

File details

Details for the file pokelance-0.0.18a0.tar.gz.

File metadata

  • Download URL: pokelance-0.0.18a0.tar.gz
  • Upload date:
  • Size: 49.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.1 CPython/3.10.8 Windows/10

File hashes

Hashes for pokelance-0.0.18a0.tar.gz
Algorithm Hash digest
SHA256 73e1c267cbec48ff880c7752ebb64d68f6ff54f68bbedfa487b2d94976d90cf4
MD5 67942571930a07b11be9026dece49278
BLAKE2b-256 27d3e5fcab547d492ef32b17beaa41bb5794d0f1164840d04f84234555df8639

See more details on using hashes here.

File details

Details for the file pokelance-0.0.18a0-py3-none-any.whl.

File metadata

  • Download URL: pokelance-0.0.18a0-py3-none-any.whl
  • Upload date:
  • Size: 71.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.1 CPython/3.10.8 Windows/10

File hashes

Hashes for pokelance-0.0.18a0-py3-none-any.whl
Algorithm Hash digest
SHA256 f0a783d09d6362c07e224b61f8b1ee920e4606a52abc4e03cf0eb31434096a91
MD5 210e9ceff9ce3790f5c0d165db4c7d3b
BLAKE2b-256 9c43a9480c249ab6772d702a11a37b42ec0b25f32fc9473617dc5eb78d280f3c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page