Optic Python Sdk
The code library standardizing data capture for Optic in Python applications. 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.
The library requires @useoptic/cli
to be installed, instructions on installing it are available https://www.useoptic.com/docs/.
pip install optic-sdk
The library provides apis to interact with optic cli. This library does not provide ecs converters and should be used along with framework specific optic libraries
Environment variables can also be used to set the values.
ENABLE
:boolean
(defaults toTrue
) 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
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
from optic import OpticConfig, Optic
def send_to_optic_cli(ecs_object):
"""
ecs_object: Json serializble ecs object
"""
config = OpticConfig(framework="<insert name>", CONSOLE=True)
optic = Optic(config)
optic.send_to_local_cli(ecs_object) #send to optic cli
optic.send_to_file(ecs_object) #save to file
optic.send_to_console(ecs_object) #send to stdout
This software is licensed under the MIT license.