No project description provided
Project description
Optic Django Middleware
This module is a plugin for Django using optic-sdk to capture and format HTTP data to send to Optic. We have a list of middleware available for some frameworks, if we are missing the framework join our community and suggest the next framework or develop it with us.
Requirements
The module requires @useoptic/cli
to be installed, instructions on installing it are available https://www.useoptic.com/docs/.
Install
pip install optic-django-unittest
Usage
The plugin is used along with Optic Django Middleware to customise optic logging behaviour based on unittest test result hooks to add features like
1. Send successful test http inteaction only
2. Send interactions in bulk
Configuration
Environment variables can also be used to set the values
ENABLE
:boolean
(defaults toFALSE
) Programmatically control if capturing data and sending it to OpticUPLOAD_URL
:string
(defaults toos.environ['OPTIC_LOGGING_URL']
) The URL to Optics capture URL, if left blank it will expectOPTIC_LOGGING_URL
environment variable set by the Optic CLICONSOLE
:boolean
(defaults toFALSE
) Send to stdout/console for debuggingframework
:string
(defaults to '') Additional information to inform Optic of where it is capturing informationLOG
:boolean
(defaults toFALSE
) Send to log fileLOG_PATH
:boolean
(defaults to./optic.log
) Log file pathLOCAL
:boolean
(defaults toTRUE
) Send to optic cli
Example
# settings.py
import os
from tempfile import mkdtemp
tempdir = mkdtemp('optic_django')
OPTIC = {
# ...optic-django-middleware settings
'INTERACTION_MANAGER': "optic_django_unittest.manager.HttpInteractionManager"
}
INSTALLED_APPS += [
'optic_django_middleware',
]
To start capturing data from the SDK, run your application with
api exec "python manage.py runserver"
License
This software is licensed under the MIT license.
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
File details
Details for the file optic-django-unittest-plugin-0.1.2.tar.gz
.
File metadata
- Download URL: optic-django-unittest-plugin-0.1.2.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.7 CPython/3.7.11 Linux/5.8.0-1039-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1fce593002fa4939afb55274ef5f0bcedd8000ecba4ef9843addf58f9acbb0f |
|
MD5 | 3a7d9524b775c5f0a244693e2df9c0cf |
|
BLAKE2b-256 | 3bc55a70ee98f5e1aeca53ebfde3e6a8fa506e4edcc552b036b2571285048945 |
File details
Details for the file optic_django_unittest_plugin-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: optic_django_unittest_plugin-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.7 CPython/3.7.11 Linux/5.8.0-1039-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 662bb49d58be7aa94b526ae0656097c51e37807613e06e7dd8c4d177c0ab8814 |
|
MD5 | 483cbc93b9190ecfcbff903aadc5f44c |
|
BLAKE2b-256 | 4e93b652621ba8d8c893c5445d5f6d7ba327505d041a4e57074b08bc63806075 |