Skip to content
This repository has been archived by the owner on Jun 19, 2019. It is now read-only.

PendragonLore/async_pokepy

Repository files navigation

DEPRECATED

I don't really feel like working on this wrapper anymore, it was a decent learning experience but other then that I find it pretty boring overall to work on it, sorry.

Logo async_pokepy

PyPI pyversions PyPI status PyPI license Documentation Status Pipelines Status Build Status CircleCI AppYevorCI

An, in the works, asynchronous wrapper for the PokeAPI.co API.

Documentation

The documentation is available at readthedocs or on gitlab pages, mostly as a backup.

Installing

The wrapper is available on PyPi and requires Python 3.5.3+, to install it just run the following command:

python3 -m pip install -U async_pokepy

# or on Windows
py -3 -m pip install -U async_pokepy

To install the development version, do the this instead:

git clone https://github.com/PendragonLore/async_pokepy.git
cd async_pokepy
python3 -m pip install -U .

Better caching

It's recommended to install the library with lru-dict, to do so, run the follwing command:

pip install async_pokepy[lru]

A warning will be thrown if the wrapper is used without this extra package.

Documentation building, linting and tests

To run tests/lint install it with:

pip install async_pokepy[tests]

The best way to run tests is by using tox.

For documentation building:

pip install async_pokepy[docs]

Example

import asyncio

import async_pokepy


async def main(query):
    client = await async_pokepy.connect()

    pokemon = await client.get_pokemon(query)

    fmt = ", ".join(map(str, pokemon.abilities))
    print("{0} has the abilities {1}".format(pokemon, fmt))

    await client.close()


loop = asyncio.get_event_loop()
loop.run_until_complete(main("Snorlax"))

This will output: "Snorlax has the abilities Gluttony, Thick Fat, Immunity".

More examples are available in the example folder in the github repository or in the introduction section of the docs.

About

An asynchronous PokeAPI.co wrapper written in Python.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages