A python API wrapper for https://animal-api.nitcord.repl.co/api
Project description
animality-py
Python Wrapper for https://animal-api.nitcord.repl.co/api
Discord Server: https://discord.gg/ESPMP7BEeJ
Made for burber. (Hamburger#0001)
Installation
$ pip install animality-py
Simple Usage
import animality
from asyncio import get_event_loop
async def run():
animal = await animality.get_animal("dog")
print(animal.name, animal.image, animal.fact)
random = await animality.random()
print(random.name, random.image, random.fact)
await animality.close()
get_event_loop().run_until_complete(run())
Using an existing aiohttp client session
import animality
import aiohttp
my_session = aiohttp.ClientSession(...)
animality.set_session(my_session)
Downloading an image response from the API
import animality
from asyncio import get_event_loop
async def run():
animal = await animality.random()
img = await animal.download_image()
with open(f"{animal.name}.png", "wb" as f:
f.write(img)
f.close()
await animality.close()
get_event_loop().run_until_complete(run())
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
animality-py-0.0.1.tar.gz
(3.8 kB
view hashes)