Skip to main content

A lightweight Python wrapper for the Dog CEO API.

Project description

🐶 DogCEOPy

A lightweight, modern Python wrapper for the Dog CEO API.

PyPI version Python versions License

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dogceopy-1.0.0.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dogceopy-1.0.0-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

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

Hashes for dogceopy-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6039cffd58622a20d76901ba34bbb3540cf4ba63caa30fa107496b340f5c986b
MD5 c4ab7d024769c6922dc818f043f46864
BLAKE2b-256 361106d5267d929d27acbe374324fa2bcb5a81a1149a555dda7ddfbac4ad14e9

See more details on using hashes here.

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

Hashes for dogceopy-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3889071efd17c2c1bce23ea105e42369faa9178b7b2f8dfd42cd15aca47bdfe5
MD5 ef08e5368a27576babb0c01222ea42f0
BLAKE2b-256 21a64724f70c0c5577b706666655475d8d690fa6d5291b806c13daf53deb8019

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page