Skip to main content

A django integration for requests.

Project description

django-requests-logger

django-requests-logger is a Django application used as a hook for Requests.

It logs every request made using the Requests library to the database and provides basic data masking for sensitive information.

You can access the logs in the Django admin site.

Installing

pip install django-requests-logger

Add django_requests_logger in INSTALLED_APPS.

Run python manage.py migrate

Usage

import requests
from django_requests_logger.callbacks import logger as requests_logger
from functools import partial

# If you want to capture only errors (HTTP 4XX client errors and 5XX server errors), then pass only_errors argument set to True.

hooks = {"response": partial(requests_logger, only_errors=True)}
requests.get('https://httpbin.org/', hooks=hooks)

TODO

Integrate this application in the Django logging as a handler.

Requirements

If you want to add yourself some functionality to the application:

  1. Fork it ( https://github.com/GearPlug/django-requests-logger )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Adds my new feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

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_requests_logger-1.0.0.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

django_requests_logger-1.0.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file django_requests_logger-1.0.0.tar.gz.

File metadata

File hashes

Hashes for django_requests_logger-1.0.0.tar.gz
Algorithm Hash digest
SHA256 28c224409e0de73a437ae9baf1d41620338756570c106281321ac108d70b2635
MD5 4183dc9c6f90c0715bb5f6fe86898211
BLAKE2b-256 b024dde2cda9c7f67b7743df03e393570ba054ea80888cf160309b858ec07a27

See more details on using hashes here.

File details

Details for the file django_requests_logger-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_requests_logger-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f93b5dbbba4746d692017459032e81b9df878b9e4323553010c0f29414748b47
MD5 ed27b1b7c95092f55cfc08426942df4e
BLAKE2b-256 b3843fe75e1979d9c7eb16ec291758836ccab2b519a1179a1e1a658cd563661b

See more details on using hashes here.

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