A simple httpcat and httpdog call function returns image data when called
Project description
httpcats-and-httpdog
这里有中文版本:readme-zh
httpcats-and-httpdog
is a Python package for retrieving images corresponding to HTTP response status codes. It allows you to get images from httpcats or httpdog based on the provided HTTP response status codes.
Installation
You can install the httpcats-and-httpdog
package via pip
:
pip install httpcats-and-httpdog
Usage
from httpcats_and_httpdog import get_image
# Get image data from httpcats
status_code = "200"
image_bytes = get_image("httpcats", status_code)
# Get image data from httpdog
status_code = "200"
image_bytes = get_image("httpdog", status_code)
The get_image
function takes three arguments: the service name (httpcats
or httpdog
), HTTP response status code, and image format (optional, default is .jpg
). It returns the byte data of the corresponding image, which you can further process or save as needed.
Error Handling
When calling the get_image
function, it raises a ValueError
if the input status code is not a three-digit number or if downloading the image fails. Please ensure to provide the correct status code and check that your network connection is working properly.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for httpcats_and_httpdog-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0a754459794d4f185a6fc8bb0f0e7b8a5d33d2ab3944d1792fb19f6065b0352 |
|
MD5 | 3293fcd63173072734b98a2364350624 |
|
BLAKE2b-256 | d78e649176f3fc58a33baeca95543f094a4a4d03890fcb5d5332e946e6b3efa9 |