A lightweight Python wrapper for the Dog CEO API.
Project description
🐶 DogCEOPy
A lightweight, modern Python wrapper for the Dog CEO API.
DogCEOPy provides a simple and Pythonic interface for retrieving dog breeds, sub-breeds, and dog images without dealing with raw HTTP requests.
Features
- 🚀 Simple and intuitive API
- 🐕 Fetch all dog breeds
- 🦴 Fetch sub-breeds
- 🖼️ Get random dog images
- 📷 Get multiple random images
- 🐶 Get breed and sub-breed images
- 📝 Fully type hinted
- 🔄 Context manager support
- ⚡ Lightweight with minimal dependencies
Installation
pip install DogCEOPy
Quick Start
from dogceopy import DogCEO
dog = DogCEO()
print(dog.random.image())
Example output:
https://images.dog.ceo/breeds/husky/n02110185_14597.jpg
Breed Information
List all breeds
from dogceopy import DogCEO
dog = DogCEO()
print(dog.breeds.list())
List all breeds with sub-breeds
print(dog.breeds.list_all())
List sub-breeds
print(
dog.breeds.sub_breeds("bulldog")
)
Output:
["boston", "english", "french"]
Check if a breed exists
print(
dog.breeds.exists("husky")
)
Output:
True
Random Images
One random dog image
print(
dog.random.image()
)
Multiple random dog images
print(
dog.random.images(5)
)
Breed Images
Random Husky image
print(
dog.images.random("husky")
)
Five random Husky images
print(
dog.images.random_many(
"husky",
5
)
)
All Husky images
print(
dog.images.all("husky")
)
Sub-Breed Images
English Bulldog is a sub-breed of Bulldog.
Random English Bulldog image
print(
dog.images.sub_random(
"bulldog",
"english"
)
)
Five random English Bulldog images
print(
dog.images.sub_random_many(
"bulldog",
"english",
5
)
)
All English Bulldog images
print(
dog.images.sub_all(
"bulldog",
"english"
)
)
Using a Context Manager
from dogceopy import DogCEO
with DogCEO() as dog:
print(
dog.random.image()
)
The HTTP session is automatically closed when the block exits.
API Overview
random
| Method | Description |
|---|---|
image() |
Get one random dog image |
images(count) |
Get multiple random dog images |
breeds
| Method | Description |
|---|---|
list() |
List all breeds |
list_all() |
List all breeds and sub-breeds |
sub_breeds(breed) |
Get sub-breeds |
exists(breed) |
Check whether a breed exists |
has_sub_breeds(breed) |
Check whether a breed has sub-breeds |
images
| Method | Description |
|---|---|
random(breed) |
Random image for a breed |
random_many(breed, count) |
Multiple random images |
all(breed) |
All images for a breed |
sub_random(breed, sub_breed) |
Random image for a sub-breed |
sub_random_many(breed, sub_breed, count) |
Multiple random images for a sub-breed |
sub_all(breed, sub_breed) |
All images for a sub-breed |
Requirements
- Python 3.8+
- requests
Running Tests
pytest
Author
Developed and maintained by JackMa
GitHub: https://github.com/Fmasterpro27
License
Licensed under the Apache License 2.0.
Acknowledgements
This library is an unofficial Python wrapper for the Dog CEO API and is not affiliated with Dog CEO.
Powered by the Dog CEO Dog API.
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 Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dogceopy-1.0.0.tar.gz.
File metadata
- Download URL: dogceopy-1.0.0.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6039cffd58622a20d76901ba34bbb3540cf4ba63caa30fa107496b340f5c986b
|
|
| MD5 |
c4ab7d024769c6922dc818f043f46864
|
|
| BLAKE2b-256 |
361106d5267d929d27acbe374324fa2bcb5a81a1149a555dda7ddfbac4ad14e9
|
File details
Details for the file dogceopy-1.0.0-py3-none-any.whl.
File metadata
- Download URL: dogceopy-1.0.0-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3889071efd17c2c1bce23ea105e42369faa9178b7b2f8dfd42cd15aca47bdfe5
|
|
| MD5 |
ef08e5368a27576babb0c01222ea42f0
|
|
| BLAKE2b-256 |
21a64724f70c0c5577b706666655475d8d690fa6d5291b806c13daf53deb8019
|