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
Metadata
Release files for django-requests-logger 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_requests_logger-1.0.0.tar.gz | 4.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_requests_logger-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.4 kB
Release files / django_requests_logger-1.0.0.tar.gz
| Download URL | django_requests_logger-1.0.0.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
28c224409e0de73a437ae9baf1d41620338756570c106281321ac108d70b2635
|
|
BLAKE2b-256 checksum How to use checksums |
b024dde2cda9c7f67b7743df03e393570ba054ea80888cf160309b858ec07a27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.9
|
Release files / django_requests_logger-1.0.0-py3-none-any.whl
| Download URL | django_requests_logger-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f93b5dbbba4746d692017459032e81b9df878b9e4323553010c0f29414748b47
|
|
BLAKE2b-256 checksum How to use checksums |
b3843fe75e1979d9c7eb16ec291758836ccab2b519a1179a1e1a658cd563661b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.9
|