pokebase


Namepokebase JSON
Version 1.4.1 PyPI version JSON
download
home_pagehttps://github.com/PokeAPI/pokebase
SummaryA Python wrapper for the friendly PokeAPI database
upload_time2023-12-20 18:17:44
maintainer
docs_urlNone
authorGreg Hilmes
requires_python
licenseBSD License
keywords database pokemon wrapper
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Pokebase [![swampert](https://veekun.com/dex/media/pokemon/main-sprites/heartgold-soulsilver/260.png)](https://pokeapi.co/api/v2/pokemon/swampert)

[![actions](https://github.com/PokeAPI/pokebase/actions/workflows/unit.yml/badge.svg)](https://github.com/PokeAPI/pokebase/actions/workflows/unit.yml)
[![Python 3.6 pypi](https://img.shields.io/badge/Python%203.6%20pypi-1.3.0-blue.svg)](https://pypi.python.org/pypi/pokebase)
[![Python >=3.8 github](https://img.shields.io/badge/Python%20>=3.8%20github-1.4.0-blue.svg)](https://github.com/PokeAPI/pokebase#version-support)

pokebase is a simple but powerful Python interface to the [PokéAPI
database](https://pokeapi.co/)

Maintainer: [GregHilmes](https://github.com/GregHilmes)

## Installation


### Version Support

pokebase 1.3.0 supports Python 3.6. Install it with `pip install pokebase`

pokebase 1.4.0 drops support for Python 3.6 and adds support for Python
\>=3.8 \<=3.12. Install it with
`pip install https://github.com/PokeAPI/pokebase/archive/1.4.0.zip`

## Usage

```python console
>>> import pokebase as pb
>>> chesto = pb.APIResource('berry', 'chesto')
>>> chesto.name
'chesto'
>>>
chesto.natural_gift_type.name
'water'
>>> charmander = pb.pokemon('charmander') # Quick lookup.
>>> charmander.height
6
>>> # Now with sprites! (again!)
>>> s1 = pb.SpriteResource('pokemon', 17)
<pokebase.interface.SpriteResource object at 0x7f2f15660860>
>>> s1.url
'<https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/17.png>'
>>> s2 = pb.SpriteResource('pokemon', 1, other=True, official_artwork=True)
>>> s2.path
'/home/user/.cache/pokebase/sprite/pokemon/other-sprites/official-artwork/1.png'
>>> s3 = pb.SpriteResource('pokemon', 3, female=True, back=True)
>>> s3.img_data b'x89PNGrnx1anx00x00x00rIHDRx00x00x00 ... xca^x7fxbbd\*x00x00x00x00IENDxaeB`x82'
```

... And it's just that simple.

## Nomenclature

> -   an `endpoint` is the results of an API call like
>     `http://pokeapi.co/api/v2/berry` or
>     `http://pokeapi.co/api/v2/move`
> -   a `resource` is the actual data, from a call to
>     `http://pokeapi.co/api/v2/pokemon/1`

## Testing

Python unit tests are in a separate `tests` directory and can be run via
`python -m tests`.

### Notes to the developer using this module

The quick data lookup for a Pokémon type, is
`pokebase.type_('type-name')`, not `pokebase.type('type-name')`. This is
because of a naming conflict with the built-in `type` function, were you
to `from pokebase import *`.

When changing the cache, avoid importing the cache constants directly.
You should only import them with the whole cache module. If you do not
do this, calling `set_cache` will not change your local copy of the
variable.

NOT THIS!

```python console
>>> from pokebase.cache import API_CACHE
```

Do this :)

```python console
>>> from pokebase import cache
>>> cache.API_CACHE
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/PokeAPI/pokebase",
    "name": "pokebase",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "database,pokemon,wrapper",
    "author": "Greg Hilmes",
    "author_email": "99hilmes.g@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/cf/f5/0c827ba3ed055c9a266ca809ebaf152a6d6b0a7932d9a48b78d471dbd2ba/pokebase-1.4.1.tar.gz",
    "platform": null,
    "description": "# Pokebase [![swampert](https://veekun.com/dex/media/pokemon/main-sprites/heartgold-soulsilver/260.png)](https://pokeapi.co/api/v2/pokemon/swampert)\r\n\r\n[![actions](https://github.com/PokeAPI/pokebase/actions/workflows/unit.yml/badge.svg)](https://github.com/PokeAPI/pokebase/actions/workflows/unit.yml)\r\n[![Python 3.6 pypi](https://img.shields.io/badge/Python%203.6%20pypi-1.3.0-blue.svg)](https://pypi.python.org/pypi/pokebase)\r\n[![Python >=3.8 github](https://img.shields.io/badge/Python%20>=3.8%20github-1.4.0-blue.svg)](https://github.com/PokeAPI/pokebase#version-support)\r\n\r\npokebase is a simple but powerful Python interface to the [Pok\u00c3\u00a9API\r\ndatabase](https://pokeapi.co/)\r\n\r\nMaintainer: [GregHilmes](https://github.com/GregHilmes)\r\n\r\n## Installation\r\n\r\n\r\n### Version Support\r\n\r\npokebase 1.3.0 supports Python 3.6. Install it with `pip install pokebase`\r\n\r\npokebase 1.4.0 drops support for Python 3.6 and adds support for Python\r\n\\>=3.8 \\<=3.12. Install it with\r\n`pip install https://github.com/PokeAPI/pokebase/archive/1.4.0.zip`\r\n\r\n## Usage\r\n\r\n```python console\r\n>>> import pokebase as pb\r\n>>> chesto = pb.APIResource('berry', 'chesto')\r\n>>> chesto.name\r\n'chesto'\r\n>>>\r\nchesto.natural_gift_type.name\r\n'water'\r\n>>> charmander = pb.pokemon('charmander') # Quick lookup.\r\n>>> charmander.height\r\n6\r\n>>> # Now with sprites! (again!)\r\n>>> s1 = pb.SpriteResource('pokemon', 17)\r\n<pokebase.interface.SpriteResource object at 0x7f2f15660860>\r\n>>> s1.url\r\n'<https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/17.png>'\r\n>>> s2 = pb.SpriteResource('pokemon', 1, other=True, official_artwork=True)\r\n>>> s2.path\r\n'/home/user/.cache/pokebase/sprite/pokemon/other-sprites/official-artwork/1.png'\r\n>>> s3 = pb.SpriteResource('pokemon', 3, female=True, back=True)\r\n>>> s3.img_data b'x89PNGrnx1anx00x00x00rIHDRx00x00x00 ... xca^x7fxbbd\\*x00x00x00x00IENDxaeB`x82'\r\n```\r\n\r\n... And it's just that simple.\r\n\r\n## Nomenclature\r\n\r\n> -   an `endpoint` is the results of an API call like\r\n>     `http://pokeapi.co/api/v2/berry` or\r\n>     `http://pokeapi.co/api/v2/move`\r\n> -   a `resource` is the actual data, from a call to\r\n>     `http://pokeapi.co/api/v2/pokemon/1`\r\n\r\n## Testing\r\n\r\nPython unit tests are in a separate `tests` directory and can be run via\r\n`python -m tests`.\r\n\r\n### Notes to the developer using this module\r\n\r\nThe quick data lookup for a Pok\u00c3\u00a9mon type, is\r\n`pokebase.type_('type-name')`, not `pokebase.type('type-name')`. This is\r\nbecause of a naming conflict with the built-in `type` function, were you\r\nto `from pokebase import *`.\r\n\r\nWhen changing the cache, avoid importing the cache constants directly.\r\nYou should only import them with the whole cache module. If you do not\r\ndo this, calling `set_cache` will not change your local copy of the\r\nvariable.\r\n\r\nNOT THIS!\r\n\r\n```python console\r\n>>> from pokebase.cache import API_CACHE\r\n```\r\n\r\nDo this :)\r\n\r\n```python console\r\n>>> from pokebase import cache\r\n>>> cache.API_CACHE\r\n```\r\n",
    "bugtrack_url": null,
    "license": "BSD License",
    "summary": "A Python wrapper for the friendly PokeAPI database",
    "version": "1.4.1",
    "project_urls": {
        "Homepage": "https://github.com/PokeAPI/pokebase"
    },
    "split_keywords": [
        "database",
        "pokemon",
        "wrapper"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "776fc96b0855965a1d151fc930168ed2e78f7c414872531899036f0b4b5093d4",
                "md5": "3a24a341c7accc5e207aa94cc064dfe3",
                "sha256": "0c3f6dcd010711f5e7e9e4bc9a0bacf094b92a9144499c449c35f00a8ce46478"
            },
            "downloads": -1,
            "filename": "pokebase-1.4.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3a24a341c7accc5e207aa94cc064dfe3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 11826,
            "upload_time": "2023-12-20T18:17:43",
            "upload_time_iso_8601": "2023-12-20T18:17:43.252162Z",
            "url": "https://files.pythonhosted.org/packages/77/6f/c96b0855965a1d151fc930168ed2e78f7c414872531899036f0b4b5093d4/pokebase-1.4.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cff50c827ba3ed055c9a266ca809ebaf152a6d6b0a7932d9a48b78d471dbd2ba",
                "md5": "eec92bfc977619f71d3a275d03f1f1ac",
                "sha256": "036116b1696dce7ef96ead3e892476648d6e3eec52fbd1e63677f944de259ecc"
            },
            "downloads": -1,
            "filename": "pokebase-1.4.1.tar.gz",
            "has_sig": false,
            "md5_digest": "eec92bfc977619f71d3a275d03f1f1ac",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 15486,
            "upload_time": "2023-12-20T18:17:44",
            "upload_time_iso_8601": "2023-12-20T18:17:44.929559Z",
            "url": "https://files.pythonhosted.org/packages/cf/f5/0c827ba3ed055c9a266ca809ebaf152a6d6b0a7932d9a48b78d471dbd2ba/pokebase-1.4.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-20 18:17:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "PokeAPI",
    "github_project": "pokebase",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "pokebase"
}
        
Elapsed time: 0.15663s