Skip to main content

A django application to display cute animal pictures based on HTTP status codes.

Project description

Test Coverage Latest PyPI version python django licence

Return a more fun and cute animal picture to your users based upon the HTTP response codes.

Demo Responses

Some of these responses may look like:

  • 404(Resource not found)

Resource not found.
  • 400(Bad request)

Bad request.

Installation

Install using pip.

$ python -m pip install django-cute-status

If you want, you may install it from the source, grab the source code and run setup.py.

$ git clone git://github.com/abhiabhi94/django-cute-status.git
$ cd django-cute-status
$ python setup.py install

Usage

Add app

To enable django_flag_app in your project you need to add it to INSTALLED_APPS in your projects settings.py file:

INSTALLED_APPS = (
    ...
    'django_cute_status',
    ...
)

Add middleware

Add the following middleware class to monitor the responses. Make sure it is at the bottom.

MIDDLEWARES = [
    ...
    'django_cute_status.middleware.CuteStatusMiddleware',
]

Configurations

There are certain configurations that allow you to customize the application.

CUTE_STATUS_BASE_URLS

This is the list of URLs to be used for displaying cute statuses. At the moment, the app only displays the pictures of dogs and cats. In case you know of any more such services(for e.g. one for pandas) you may add them here. Also, it would be great if you could take a moment to make a pull request to add the feature here as well. Defaults to :

 = (
    'https://http.dog/{status_code}.jpg',
    'https://http.cat/{status_code}.jpg',
)

CUTE_STATUS_BASE_URL

The default URL for displaying cute statuses. Suppose, you want only cat pictures as status code, you can use this by setting it to http://http.cat/{status_code}. This is useful only when you have set CUTE_STATUS_USE_RANDOM to False.

CUTE_STATUS_BASE_TEMPLATE

The base template used for rendering cute statuses. It is advisable to override this to cater the web page according to your needs. For example, you might want your header and footer etc. to also be added along the cute status codes. Defaults to 'django_cute_status/base.html'.

CUTE_STATUS_USE_RANDOM

This tells whether to display cute statuses using one of the available URLs randomly. Defaults to True.

CUTE_STATUS_FOR_CODES

This a list of status code for which cute status will be displayed. Defaults to cute_status_for_codes.

CUTE_STATUS_NOT_FOR_CODES

This is a list of status code for which cute status will not be displayed. You may want to display text as per you business logic. Defaults to cute_status_not_for_codes.

CUTE_STATUS_HEADER

This is the header sent added to the response. It can be useful in determining when you want to render your own responses, CSS, JS, media files etc. Defaults to 'X-Cute-Status'.

CUTE_STATUS_OVERRIDE_HEADER_ON_ALL

Whether to add the CUTE_STATUS_HEADER on all HTTP requests or not. Defaults to False.

Credits

The application wouldn’t have been possible without the excellent pictures served by https://http.dog and https://http.cat. Many thanks to them for their cute pictures.

Development

For setting up development environment, you may see the guidelines at CONTRIBUTING.rst.

Project details


Download files

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

Source Distribution

django_cute_status-2.0.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_cute_status-2.0.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file django_cute_status-2.0.0.tar.gz.

File metadata

  • Download URL: django_cute_status-2.0.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for django_cute_status-2.0.0.tar.gz
Algorithm Hash digest
SHA256 786d96fccfc6a2bb4412cc61ae4d613ae6405d383d4f563b587f7bc48128e828
MD5 2304c19630223ccc51b71424c3d4921e
BLAKE2b-256 22eebbcf021a14179c9cb391cb3e1c4a58545d6531049aff4780ed5db32a8684

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_cute_status-2.0.0.tar.gz:

Publisher: release.yml on abhiabhi94/django-cute-status

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_cute_status-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_cute_status-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c594a9607fc342f197e8755bd0575d2ac126426d3a8aeed8faeb5bf5300502b
MD5 2f1859e27b3c3ae1058bc7ef9539fb47
BLAKE2b-256 c8503e489f0c0ce255603924424d799dd880282624e81f04f6badde21bc97437

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_cute_status-2.0.0-py3-none-any.whl:

Publisher: release.yml on abhiabhi94/django-cute-status

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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