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
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
-
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
-
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
-
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
-
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)
-
Will there be an aync version of this?
- I currently have no plans to do it in the near future. If you really want an asynchronous wrapper, take a look at catapi.py
-
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.
-
Where is the documentation?
- Currently, there is no documentation for this wrapper. Alternatively, you can take a look at the API documentation and the source to figure out some stuff.
Note: all changes were tested on python 3.10.0 64-bit before being published
License
GNU AGPLv3