Skip to main content

Bearer python helper

Project description

Bearer Python

Bearer Python client


pip install bearer


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
github = (
      .integration('your integration id') # you'll find it on the Bearer dashboard
      .auth('your auth id') # Create an auth id for your integration via the dashboard


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('/user/repos', body={ 'name': 'Just setting up my' }).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



# setup venv
$ python -m venv venv

# install dependencies
$ venv/bin/python develop

# start the console
$ venv/bin/python

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bearer-3.1.0.tar.gz (7.7 kB view hashes)

Uploaded Source

Built Distribution

bearer-3.1.0-py3-none-any.whl (9.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page