Skip to main content

A simple httpcat and httpdog call function returns image data when called

Project description

httpcats-and-httpdog

Python License

这里有中文版本: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

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

httpcats-and-httpdog-0.1.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

httpcats_and_httpdog-0.1-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page