animalapi
A simple Python wrapper for the some-random-api.ml API.
<img src="https://img.shields.io/pypi/v/animalapi.svg" alt="PyPI version" />
<img src="https://img.shields.io/github/license/dashutosh04/animalapi.svg" alt="License" />
Easily access animal images and facts in your Python projects.
Features
-
Random Animal Data: Get randomized animal data (image and fact) with rand_animals()
.
-
Specific Animal Data: Fetch data for a specific animal using animal_data(animal_name)
.
-
Supported Animals: Currently supports "dog", "cat", "bird" and "koala".
-
Error Handling: Provides informative error messages and handles invalid animal names and API request errors.
Installation
pip install animalapi
Usage
Get random animal data
import animalapi as a
data = a.rand_animals()
img = data["image"]
fact = data["fact"]
print(img)
print(fact)
Get data for a specific animal
import animalapi as a
data = a.animal_data("dog")
img = data["image"]
fact = data["fact"]
print(img)
print(fact)
Contributing
Contributions are welcome! Feel free to open issues or pull requests.
License
This project is licensed under the MIT License - see the LICENSE file for details.