Bearer Agent
Project description
Bearer Agent
Observe, control and receive alerts on your third-party APIs by adding the Bearer agent to your Python application.
Documentation
The documentation is hosted at https://python.docs.bearer.sh/
Installation
The Bearer agent requires Python 3.x >= 3.5.
Install from PyPI:
$ pip install bearer-agent
Then set up the Bearer agent with your Secret Key (available on the Bearer dashboard):
import bearer_agent
bearer_agent.init(secret_key="YOUR_BEARER_SECRET_KEY")
Keeping your data protected
We recommend you sanitize your data before sending it to the Bearer dashboard. We think it's best to setup the sanitization level that best suits your needs. An example using the default values is as follows:
bearer_agent.init(
strip_sensitive_data=True,
strip_sensitive_keys=(
"^authorization$|"
"^password$|"
"^secret$|"
"^passwd$|"
"^api.?key$|"
"^access.?token$|"
"^auth.?token$|"
"^credentials$|"
"^mysql_pwd$|"
"^stripetoken$|"
"^card.?number.?$|"
"^secret$|"
"^client.?id$|"
"^client.?secret$"
),
strip_sensitive_regex=(
r"[a-zA-Z0-9]{1}[a-zA-Z0-9.!#$%&’*+=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*|"
r"(?:\d[ -]*?){13,16}"
)
)
Compatibility matrix
Python3 :
On Python 3.x (>= 3.5) bearer support the following:
- http.client for Python >= 3.6
- urllib3 :
- requests
- httpcore >= 0.9 (both HTTP 1.1 and HTTP 2)
- httpx >= 0.12
- Twisted >= 19.2
- aiohttp >= 3.6.2
On Python 2.7, bearer support the following client Library or application based on:
Development
Running tests
To run a format check (black), the linter (flake8) and tests (pytest):
$ tox
To only run the tests:
$ tox -e py37
Git hooks
There are Git hooks to format the code and run the linter when committing.
Install https://pre-commit.com/ and then run:
$ pre-commit install
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
Hashes for bearer_agent-1.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8688250162d3baf47439dc07aef4877ea197c45d305fdb68c9d3b0b1f1a485df |
|
MD5 | c926f21f0f341bdc6e7c9d824184134e |
|
BLAKE2b-256 | c12001dac65b8221aa1b406dc564d18c25a8eef42572ace864af05c1b2025579 |