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:
- Fork it ( https://github.com/GearPlug/django-requests-logger )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Adds my new feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_requests_logger-1.0.0.tar.gz.
File metadata
- Download URL: django_requests_logger-1.0.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28c224409e0de73a437ae9baf1d41620338756570c106281321ac108d70b2635
|
|
| MD5 |
4183dc9c6f90c0715bb5f6fe86898211
|
|
| BLAKE2b-256 |
b024dde2cda9c7f67b7743df03e393570ba054ea80888cf160309b858ec07a27
|
File details
Details for the file django_requests_logger-1.0.0-py3-none-any.whl.
File metadata
- Download URL: django_requests_logger-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f93b5dbbba4746d692017459032e81b9df878b9e4323553010c0f29414748b47
|
|
| MD5 |
ed27b1b7c95092f55cfc08426942df4e
|
|
| BLAKE2b-256 |
b3843fe75e1979d9c7eb16ec291758836ccab2b519a1179a1e1a658cd563661b
|