Skip to main content

cats.py

A synchronous, object oriented API wrapper for thecatapi

Table Of Content

Installation

  • Install it from pypi

    pip install cats.py
    
  • To install the development version, clone this repository and install it. You need git installed for this

    pip install git+https://github.com/MarzaElise/cats.py.git
    

Usage

If you don't already have an API key, get one here

from cats import Client

client = Client(api_key="YOUR API KEY HERE")

breed = client.search_breed("beng")

print(breed)

The above code should print something similar to this

screenshot

For async support, import Client from async_cats instead of cats.

More usage examples can be found here

Contributing

This module/repository is new and might break at any moment. Which is why all pull requests that bring good changes are welcome.

If you are new to github and wondering how to contribute, click here

If you are confused on what would be a good contribution, take a look at the open issues

FAQ

  1. Are all endpoints supported?

    • All of the endpoints except for images/upload works perfectly as I tested them locally before publishing
    • All breeds/ endpoints might break since the API is constantly adding new properties
  2. Why is utils/_dataclasses.py such a code-gore?

    • Data returned by the API is inconsistent. For example, some properties are sometimes given and sometimes not. To manage that I set them all to None by default
  3. How is this wrapper object oriented?

    • All values returned by each method has its own class (Breed, Vote, Favourite etc)
    • This entire wrapper revolves around dataclasses and subclassing
  4. I found a bug, how do I report?

    • You can contact me on discord at Marcus | Bot Dev#4438
    • If you are not on discord, open a new issue
    • If you also have a fix for it, create a new pull request and I'll merge it if its good. (See Contributing)
  5. How to use this in an asynchronous environment?

    • You can import and use the async_cats.Client class for async support. A simple example can be found in examples/async.py
  6. Is this wrapper consistent?

    • I tried my best to keep this wrapper consistent with the API itself. By returning lists when API returns an array etc.
  7. Where is the documentation?

    • Currently, there is no documentation for this wrapper. Alternatively, you can take a look at the API documentation, the docstrings and the source to figure out what you need
  8. Who asked?

    • I did

Note: all changes were tested on python 3.10.0 64-bit before being published

What's new

  • Support for asynchronous environment
  • New async_cats package
  • More examples in the examples folder

License

GNU AGPLv3

Metadata

Release files for cats.py 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for cats.py 1.0.0
File Interpreter ABI Platform Actions
cats.py-1.0.0-py3.10.egg Legacy Egg format - - Details for cats.py-1.0.0-py3.10.egg

Release files / cats.py-1.0.0-py3.10.egg

Download URL cats.py-1.0.0-py3.10.egg
Size 54.8 kB
Tags Egg
SHA-256 checksum
How to use checksums
57ec7314d28f817a5743871304ac188f29fbcdf252b3c9cdfcb7f5991b8c6218
BLAKE2b-256 checksum
How to use checksums
1f422d3c63b084442541a40aa7797e678a3a0065215e9d0de7d72628559b53c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

Security for cats.py 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page