A simple asynchronous wrapper for the PokeAPI.co API.
Project description
async_pokepy
An, in the works, asynchronous wrapper for the PokeAPI.co API.
You can check out the (failing) pipelines @ gitlab.
Documentation
The docs are available @ readthedocs.
Installing
The wrapper is available on PyPi, you can install it with:
pip install async_pokepy
Better caching
It's very recommended to install the library with lru-dict, you can do this by installing the wrapper with this command:
pip install async_pokepy[lru]
The wrapper will throw a warning if you try to use it without this extra package.
Tests and docs
If you also want to be able to run the tests/lint install it with:
pip install async_pokepy[tests]
The best way to run tests is by using tox
.
For docs building:
pip install async_pokepy[docs]
Example
import asyncio
import async_pokepy
async def main(query):
client = await async_pokepy.Client.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".
You can check out more examples in the example folder in the github repository or in the introduction section of the docs.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for async_pokepy-0.1.5a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45972ef4c76d3ff9849d4480395063b162720fb8e464134edabb60df758982ed |
|
MD5 | cfeca76580e4cecc206c77841dfabe38 |
|
BLAKE2b-256 | 2d9b9623ec01885cfe613a010e89e9af91a498f2ca01df7dc8f99b016dcf7868 |