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

Uploaded Source

Built Distribution

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

Uploaded Python 3

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