Install the Python Agent¶
The Lightrun agent is at the core of the Lightrun platform. It's the component that enables us to add information at runtime, without any redeployments or restarts.
In order to install the Lightrun Python agent directly please follow these steps:
Install the python agent by running
python -m pip install lightrun.
Import Lightrun inside your
mainfunction by adding the following code to the beginning of the function:
try: import lightrun lightrun.enable(com_lightrun_server="https://app.lightrun.com/company/<COMPANY_NAME>", com_lightrun_secret="<COMPANY_SECRET>",) except ImportError as e: print("Error importing Lightrun: ", e)
Run the application as you normally would, i.e.
Getting Company Details
You can get
<COMPANY_SECRET> by logging into the the Management Portal and looking inside the Download the Agent section.
You can also pass the
<COMPANY_SECRET> as environment variables:
python -m lightrun --com_lightrun_server=https://app.lightrun.com/company/<COMPANY-NAME> --com_lightrun_secret=<COMAPNY-SECRET> -- app.py