Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gearplug/django-requests-logger
django-requests-logger is a Django application used as a hook for Requests.
https://github.com/gearplug/django-requests-logger
app django integration logging python requests standalone
Last synced: 3 days ago
JSON representation
django-requests-logger is a Django application used as a hook for Requests.
- Host: GitHub
- URL: https://github.com/gearplug/django-requests-logger
- Owner: GearPlug
- License: mit
- Created: 2018-12-31T19:18:23.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-28T16:07:40.000Z (over 1 year ago)
- Last Synced: 2024-11-09T12:06:37.057Z (5 days ago)
- Topics: app, django, integration, logging, python, requests, standalone
- Language: Python
- Homepage:
- Size: 14.6 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# django-requests-logger
django-requests-logger is a Django application used as a hook for [Requests](http://docs.python-requests.org/en/master/).
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
* [Django](https://github.com/django/django)
* [requests](https://github.com/requests/requests)#### 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