Name | pokeapi-sdk JSON |
Version |
0.1.1
JSON |
| download |
home_page | None |
Summary | None |
upload_time | 2024-09-25 23:31:19 |
maintainer | None |
docs_url | None |
author | Your Name |
requires_python | <4.0,>=3.12 |
license | None |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# PokeAPI SDK
A simple Python SDK for interacting with the [PokeAPI](https://pokeapi.co/), 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):
```bash
pip install pokeapi-sdk
```
## Usage
### 1. Initialize the PokeAPI Client
To start using the SDK, you need to initialize the `PokeAPIClient` class.
```python
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.
```python
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.
```python
pokemons = client.get_pokemons(limit=10, offset=0)
```
### 4. Fetch Pokémon Generations
You can retrieve a list of Pokémon generations:
```python
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:
```python
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.
Raw data
{
"_id": null,
"home_page": null,
"name": "pokeapi-sdk",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.12",
"maintainer_email": null,
"keywords": null,
"author": "Your Name",
"author_email": "you@example.com",
"download_url": "https://files.pythonhosted.org/packages/d8/88/c477a33313f6c7005cd9b0b4af9f94b1eb5d7e919c9eff9e080a7bf94b52/pokeapi_sdk-0.1.1.tar.gz",
"platform": null,
"description": "\n# PokeAPI SDK\n\nA simple Python SDK for interacting with the [PokeAPI](https://pokeapi.co/), allowing you to retrieve details about Pok\u00e9mon, generations, and more.\n\n## Features\n\n- Fetch details about a specific Pok\u00e9mon by its ID or name\n- Retrieve a paginated list of Pok\u00e9mon\n- Fetch a list of Pok\u00e9mon generations\n- Retrieve information about Pok\u00e9mon in a specific generation\n\n## Installation\n\nInstall the SDK using pip after building and publishing it (or directly from the source):\n\n```bash\npip install pokeapi-sdk\n```\n\n## Usage\n\n### 1. Initialize the PokeAPI Client\n\nTo start using the SDK, you need to initialize the `PokeAPIClient` class.\n\n```python\nfrom pokeapi_sdk.client import PokeAPIClient\n\nclient = PokeAPIClient()\n```\n\n### 2. Fetch Pok\u00e9mon Details\n\nYou can fetch details of a Pok\u00e9mon by providing its ID or name.\n\n```python\npokemon = client.get_pokemon(\"pikachu\")\n```\n\n### 3. Fetch a Paginated List of Pok\u00e9mon\n\nYou can fetch a list of Pok\u00e9mon with pagination using the `limit` and `offset` parameters.\n\n```python\npokemons = client.get_pokemons(limit=10, offset=0)\n```\n\n### 4. Fetch Pok\u00e9mon Generations\n\nYou can retrieve a list of Pok\u00e9mon generations:\n\n```python\ngenerations = client.get_pokemon_generation_list()\n```\n\n### 5. Fetch Pok\u00e9mon by Generation\n\nYou can fetch all Pok\u00e9mon in a specific generation by its identifier:\n\n```python\ngeneration = client.get_pokemon_by_generation(\"generation-i\")\n```\n\n## Error Handling\n\nThe SDK uses custom exceptions to handle various error cases:\n\n- **`PokeAPIError`**: Raised when a general error occurs with the PokeAPI.\n- **`PokemonNotFoundError`**: Raised when a specific Pok\u00e9mon is not found (404 error).\n\nYou can handle these exceptions as shown in the examples above to ensure your application handles errors gracefully.\n",
"bugtrack_url": null,
"license": null,
"summary": null,
"version": "0.1.1",
"project_urls": {
"homepage": "https://github.com/ThomasN72/pokeapi-sdk",
"repository": "https://github.com/ThomasN72/pokeapi-sdk"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "58c0ebee481140977520b5f38cf27d91a48bbc2b56e24649ff85395305a76bc1",
"md5": "ea59155763c795b7c523ad8116dd7fd0",
"sha256": "0e2489565c4bca835b5d63c61d5fea230f48e3572bc112b0019f955f3823ce14"
},
"downloads": -1,
"filename": "pokeapi_sdk-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ea59155763c795b7c523ad8116dd7fd0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.12",
"size": 2951,
"upload_time": "2024-09-25T23:31:18",
"upload_time_iso_8601": "2024-09-25T23:31:18.789179Z",
"url": "https://files.pythonhosted.org/packages/58/c0/ebee481140977520b5f38cf27d91a48bbc2b56e24649ff85395305a76bc1/pokeapi_sdk-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d888c477a33313f6c7005cd9b0b4af9f94b1eb5d7e919c9eff9e080a7bf94b52",
"md5": "aee197f12d53377588797f3ea6a5036c",
"sha256": "00b708a3d55c5608a38eeb21ee44fec7236c58bc1e763cbc7e78a2a9fba7683a"
},
"downloads": -1,
"filename": "pokeapi_sdk-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "aee197f12d53377588797f3ea6a5036c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.12",
"size": 2463,
"upload_time": "2024-09-25T23:31:19",
"upload_time_iso_8601": "2024-09-25T23:31:19.776712Z",
"url": "https://files.pythonhosted.org/packages/d8/88/c477a33313f6c7005cd9b0b4af9f94b1eb5d7e919c9eff9e080a7bf94b52/pokeapi_sdk-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-25 23:31:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ThomasN72",
"github_project": "pokeapi-sdk",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pokeapi-sdk"
}