Skip to main content

httpcats Badge Badge 2

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 -

from httpcats import cat_by_name

my_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 -

from httpcats import cat_by_code

my_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 -

from httpcats import cat_by_code
from PIL import Image
from io import BytesIO

my_cat = cat_by_code(302)

cat_image = Image.open(BytesIO(my_cat.image))
cat_image.show()

# Output below -
Cat

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.

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 - wulf.developer@gmail.com
Discord - wulf#9716

Metadata

Release files for httpcats 1.1.1

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

Source distribution (sdist)

Source distribution for httpcats 1.1.1
File Size Uploaded
httpcats-1.1.1.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for httpcats 1.1.1
File Interpreter ABI Platform
httpcats-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.3 kB

Release files / httpcats-1.1.1.tar.gz

Download URL httpcats-1.1.1.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9eeb879fd80d969f46ce21c31f78c4c94a990889d22fd33bec476c639122ead6
BLAKE2b-256 checksum
How to use checksums
2f6cde35724b035db86b4b3f2eabe7b9754fce5118fe8ba9476a1bd408524610
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.4

Release files / httpcats-1.1.1-py3-none-any.whl

Download URL httpcats-1.1.1-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
afb9f28812599e6cbadbba31e739f7c88a3fa0d3564df9c9f8026aa8039b0f22
BLAKE2b-256 checksum
How to use checksums
b2c0572e9941bed69fc4b93177d49f00837c0ab8b20663a87c25a8ff816b3ced
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.4

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

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