https://github.com/seven7ty/httpcats
Bringing you closer to your favorite HTTP Cats.
https://github.com/seven7ty/httpcats
cat cats http httpcats package pypi pypi-package python python3 python38
Last synced: about 2 months ago
JSON representation
Bringing you closer to your favorite HTTP Cats.
- Host: GitHub
- URL: https://github.com/seven7ty/httpcats
- Owner: seven7ty
- License: mit
- Created: 2020-11-03T20:42:49.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2020-11-10T19:10:15.000Z (over 4 years ago)
- Last Synced: 2025-03-26T05:22:45.015Z (3 months ago)
- Topics: cat, cats, http, httpcats, package, pypi, pypi-package, python, python3, python38
- Language: Python
- Homepage: https://pypi.org/project/httpcats/
- Size: 35.2 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# httpcats [](https://pypi.org/project/httpcats/) [](https://pypi.org/project/httpcats/)
Getting URLs to your favourite HTTP Cats made easy!### Installation
Installing `httpcats` is easy, just run `pip install httpcats`!
### Usage
I've developed `httpcats` to make using HTTP Cats simple and fun.
Currently, you can get your cats using one of two functions - `cat_by_name` and `cat_by_code`
`cat_by_name(name: str)` takes in a sole parameter - `name`, which is the status code name to get a cat for.
Upon finding a cat matching the name, it returns an `HTTPCat` object. Here's an example -```py
from httpcats import cat_by_namemy_cat = cat_by_name("Success")
print(f"My cat has a code of {my_cat.code} and means {my_cat.name}! The URL is {my_cat.url}")
# Prints -
# My cat has a code of 200 and means Success! The URL is https://http.cat/200
````cat_by_code(code: int)` is extremely similar to `cat_by_name`, just using a status code value.
Upon finding a cat matching the code, it returns an `HTTPCat` object. Here's an example -```py
from httpcats import cat_by_codemy_cat = cat_by_code(404)
print(f"My cat has a code of {my_cat.code} and means {my_cat.name} :( The URL is {my_cat.url}")
# Prints -
# My cat has a code of 404 and means Not Found :( The URL is https://http.cat/404
```##### The HTTPCat object also has an `image` attribute
You can use this attribute to get the image bytes associated with the cat.
You can then save it or view it, like in the example below -```py
from httpcats import cat_by_code
from PIL import Image
from io import BytesIOmy_cat = cat_by_code(302)
cat_image = Image.open(BytesIO(my_cat.image))
cat_image.show()# Output below -
```
### Contributing
This package is opensource so anyone with adequate python experience can contribute to this project!
### Report Issues
If you find any error/bug/mistake with the package or in the code feel free to create an issue and report it [here.](https://github.com/itsmewulf/httpcats/issues)### Fix/Edit Content
If you want to contribute to this package, fork the repository, make your changes and then simply create a Pull Request!### Contact
If you want to contact me -
**Mail -** ```[email protected]```
**Discord -** ```wulf#9716```