A simple Python wrapper for the some-random-api.ml API.
Easily access animal images and facts in your Python projects.
- 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.
pip install animalapi
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)
Contributions are welcome! Feel free to open issues or pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.