Skip to main content

A lightweight Python wrapper for the finda.cat API.

Project description

FindaCat API Wrapper

A lightweight Python wrapper for the finda.cat API, providing easy access to cat images and related data.

Features

  • Get random cat images with customizable options (format, blur, saturation, text, etc.)
  • Retrieve API statistics
  • Get all available cat image IDs
  • Access the history of cat images in Base64 format

Installation

  • Python 3.7 or higher
pip install findacat

Usage

from findacat import FindaCat, CatOptions

client = FindaCat()
opts = CatOptions(format="png", blur=1)

# Get a random cat image with options
image_bytes = client.get_cat_image(opts)

with open("cat.png", "wb") as f:
    f.write(image_bytes)

# Get API statistics (JSON)
stats = client.get_stats()
print(stats)

# Get all cat image IDs (JSON)
all_images = client.get_all_images()
print(all_images)

# Get Base64 cat images history (JSON)
history = client.get_history()
print(history)

Notes

  • The get_cat_image method returns the image content as bytes.
  • Other methods return JSON responses from the API.
  • Use CatOptions to customize the image request parameters.
  • Errors from the API are raised as exceptions for image requests, or returned as JSON with an "error" key for data requests.

Links

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

findacat-1.0.0.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

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

findacat-1.0.0-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file findacat-1.0.0.tar.gz.

File metadata

  • Download URL: findacat-1.0.0.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for findacat-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7b376fe605865d9f4f5d6543a1dca7daada61508f7d02ac4376e8122e2efaf4a
MD5 d6d856c683aa197e55d4609f77fceaf5
BLAKE2b-256 a46ad47959e65a889c1b3aef0d3a4e95ab81664ebd48ea9938d4199abf4fcde2

See more details on using hashes here.

File details

Details for the file findacat-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: findacat-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for findacat-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1bed988c7ea8d302b1f7c8bedff9895d128c3a74cfd263108f9a06090795a4f8
MD5 c5139a4371d24cc36af6d13f4bf2bd22
BLAKE2b-256 b59f07cd7ebb1c52a412c585c542770b57e3cd91d4493b419e114c62280fa394

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