Skip to main content

A flexible and easy to use pokemon library.

Project description

PokeLance

logo

license black mypy ruff stars downloads 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())

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

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.2.5.tar.gz (52.7 kB view details)

Uploaded Source

Built Distribution

pokelance-0.2.5-py3-none-any.whl (75.2 kB view details)

Uploaded Python 3

File details

Details for the file pokelance-0.2.5.tar.gz.

File metadata

  • Download URL: pokelance-0.2.5.tar.gz
  • Upload date:
  • Size: 52.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.1 Linux/6.2.0-1018-azure

File hashes

Hashes for pokelance-0.2.5.tar.gz
Algorithm Hash digest
SHA256 c2b092e3fd022e1034aeee5b85e91bad850379d64b095a0b439521c88673ce16
MD5 8a9e14eda712d3e3882860db82a7f7bc
BLAKE2b-256 badc93c58702d3c325eecce36ecc274e5fc3ed6e6482ef323480a5328609d081

See more details on using hashes here.

File details

Details for the file pokelance-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: pokelance-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 75.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.1 Linux/6.2.0-1018-azure

File hashes

Hashes for pokelance-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 009a0f4eaa1f9844bfa6b57c09d2c5732d6614f3f54fbd07b33812e8cfbf07d7
MD5 cca32d8b166f7f1c88cf052a8a40d733
BLAKE2b-256 a6824c52eb2b715ef093033b250351f0247224d1b0ff3d95b6b001bc8dba293c

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