Bearer Python
Bearer Python client
Installation
pip install bearer
Usage
Get your Bearer Secret Key and integration id from the Dashboard and use the Bearer client as follows:
Calling any APIs
from bearer import Bearer
bearer = Bearer('BEARER_SECRET_KEY') # find it on https://app.bearer.sh/keys
github = (
bearer
.integration('your integration id') # you'll find it on the Bearer dashboard https://app.bearer.sh
.auth('your auth id') # Create an auth id for your integration via the dashboard
)
print(github.get('/repositories').json())
We use requests internally and we
return the response from this library from the request methods (request,
get, head, post, put, patch, delete).
More advanced examples:
# With query parameters
print(github.get('/repositories', query={ 'since': 364 }).json())
# With body data
print(github.post('/user/repos', body={ 'name': 'Just setting up my Bearer.sh' }).json())
Setting the request timeout, and other http client settings
Bearer client is written on top of excellent requests library. Bearer provides reasonable defaults but you can adjust http client configuration by using any keyword argument which is accepted by requests.request method using http_client_settings keyword argument.
By default bearer client times out after 5 seconds. Bearer allows to increase the timeout to up to 30 seconds
from bearer import Bearer
bearer = Bearer('BEARER_SECRET_KEY', http_client_settings={"timeout": 10}) # increase the request timeout to 10 seconds globally
# you can specify client settings per integration as well
github = bearer.integration('github', http_client_settings={"timeout": 2}) # github api is super fast 2 seconds should be plenty
print(github.get('/user/repos'))
Development
# setup venv
$ python -m venv venv
# install dependencies
$ venv/bin/python setup.py develop
# start the console
$ venv/bin/python
Metadata
Release files for bearer 3.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bearer-3.1.0.tar.gz | 7.7 kB | Without provenance | Details for bearer-3.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bearer-3.1.0-py3-none-any.whl | Python 3 | none | any | Details for bearer-3.1.0-py3-none-any.whl |
Total release size: 17.5 kB
Release files / bearer-3.1.0.tar.gz
| Download URL | bearer-3.1.0.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3737cad0010d73890d026df536c7cd4ad0ce0996f86d8356a97848937a4d6a84
|
|
BLAKE2b-256 checksum How to use checksums |
1c1a6e82d7a52d480450f0e50186b075be7396a12d594c0a91906dcf19ee710d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.4
|
Release files / bearer-3.1.0-py3-none-any.whl
| Download URL | bearer-3.1.0-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0f61b1d8bdde4bf4ffc506de37aff039778687543d2d9bf0813d5e72c50904ed
|
|
BLAKE2b-256 checksum How to use checksums |
04fa08b2f336a8c3824e6fecf61af5187cb347caaa0a45b9dd9dfd89b063b1e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.4
|
Security for bearer 3.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.