Skip to main content

No project description provided

Project description

PokeAPI SDK

A simple Python SDK for interacting with the PokeAPI, allowing you to retrieve details about Pokémon, generations, and more.

Features

  • Fetch details about a specific Pokémon by its ID or name
  • Retrieve a paginated list of Pokémon
  • Fetch a list of Pokémon generations
  • Retrieve information about Pokémon in a specific generation

Installation

Install the SDK using pip after building and publishing it (or directly from the source):

pip install pokeapi-sdk

Usage

1. Initialize the PokeAPI Client

To start using the SDK, you need to initialize the PokeAPIClient class.

from pokeapi_sdk.client import PokeAPIClient

client = PokeAPIClient()

2. Fetch Pokémon Details

You can fetch details of a Pokémon by providing its ID or name.

pokemon = client.get_pokemon("pikachu")

3. Fetch a Paginated List of Pokémon

You can fetch a list of Pokémon with pagination using the limit and offset parameters.

pokemons = client.get_pokemons(limit=10, offset=0)

4. Fetch Pokémon Generations

You can retrieve a list of Pokémon generations:

generations = client.get_pokemon_generation_list()

5. Fetch Pokémon by Generation

You can fetch all Pokémon in a specific generation by its identifier:

generation = client.get_pokemon_by_generation("generation-i")

Error Handling

The SDK uses custom exceptions to handle various error cases:

  • PokeAPIError: Raised when a general error occurs with the PokeAPI.
  • PokemonNotFoundError: Raised when a specific Pokémon is not found (404 error).

You can handle these exceptions as shown in the examples above to ensure your application handles errors gracefully.

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

pokeapi_sdk-0.1.1.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pokeapi_sdk-0.1.1-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file pokeapi_sdk-0.1.1.tar.gz.

File metadata

  • Download URL: pokeapi_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Darwin/22.1.0

File hashes

Hashes for pokeapi_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 00b708a3d55c5608a38eeb21ee44fec7236c58bc1e763cbc7e78a2a9fba7683a
MD5 aee197f12d53377588797f3ea6a5036c
BLAKE2b-256 d888c477a33313f6c7005cd9b0b4af9f94b1eb5d7e919c9eff9e080a7bf94b52

See more details on using hashes here.

File details

Details for the file pokeapi_sdk-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pokeapi_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Darwin/22.1.0

File hashes

Hashes for pokeapi_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0e2489565c4bca835b5d63c61d5fea230f48e3572bc112b0019f955f3823ce14
MD5 ea59155763c795b7c523ad8116dd7fd0
BLAKE2b-256 58c0ebee481140977520b5f38cf27d91a48bbc2b56e24649ff85395305a76bc1

See more details on using hashes here.

Supported by

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