Skip to main content

Log outgoing requests made by the requests python library

Project description

1 django-log-outgoing-requests

Version:

0.1.0

Source:

https://github.com/maykinmedia/django-log-outgoing-requests

Keywords:

logging

PythonVersion:

3.9

Build status Code quality checks black Coverage status Documentation Status

python-versions django-versions pypi-version

Log and save outgoing requests made by requests library

2 Features

  • Log outgoing requests

  • Save logs in database

  • Overview of the saved logs in the admin page

3 Installation

3.1 Requirements

  • Python 3.7 or above

  • setuptools 30.3.0 or above

  • Django 3.2 or newer

3.2 Install

pip install django-log-outgoing-requests

4 Usage

To use this with your project you need to follow these steps:

  1. Add Django Log Outgoing Requests to INSTALLED_APPS in your Django project’s settings.py:

    INSTALLED_APPS = (
      # ...,
      "log_outgoing_requests"
    )
  2. Update your settings.py file with the following (if you haven’t defined logging yet, you can see the Django’s documentation):

    from log_outgoing_requests.formatters import HttpFormatter
    
    
    LOGGING = {
        #...,
        "formatters": {
            #...,
            "outgoing_requests": {"()": HttpFormatter},
        },
        "handlers": {
            #...,
            "log_outgoing_requests": {
                "level": "DEBUG",
                "formatter": "outgoing_requests",
                "class": "logging.StreamHandler",
            },
            "save_outgoing_requests": {
                "level": "DEBUG",
                "class": "log_outgoing_requests.handlers.DatabaseOutgoingRequestsHandler",
            },
        },
        "loggers": {
            #...,
            "requests": {
                "handlers": ["log_outgoing_requests", "save_outgoing_requests"],
                "level": "DEBUG",
                "propagate": True,
            },
        },
    }
    
    LOG_OUTGOING_REQUESTS_DB_SAVE = True # save logs enabled/disabled based on the boolean value
  3. Run the migrations

    python manage.py migrate

5 Local development

To install and develop the library locally, use:

pip install -e --no-build-isolation .[tests,coverage,docs,pep8,release]

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-log-outgoing-requests-0.1.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file django-log-outgoing-requests-0.1.0.tar.gz.

File metadata

  • Download URL: django-log-outgoing-requests-0.1.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/5.1.0 pkginfo/1.7.0 requests/2.12.4 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

File hashes

Hashes for django-log-outgoing-requests-0.1.0.tar.gz
Algorithm Hash digest
SHA256 98d42de856e4c1e67362d5cffc64d7fcd0d6622017ddcd5d24c2faf9253e905b
MD5 65bfdeaa8149121c7492d494708d6c41
BLAKE2b-256 f4c7790198b7aa04e737c109a7ff11d5ebd06cc18898c85e3105bbb9997da061

See more details on using hashes here.

File details

Details for the file django_log_outgoing_requests-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: django_log_outgoing_requests-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/5.1.0 pkginfo/1.7.0 requests/2.12.4 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

File hashes

Hashes for django_log_outgoing_requests-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 093e07386737a44a73eed6f5cdddfdce9b01c7553a119aa87531a8d0912338a5
MD5 20071566b055fbabba2200ab1edb9b35
BLAKE2b-256 40104e8682732c394f1fe6e90a49852732fbdc0f15c1abdfe2916d90c11a6a57

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