Python

Start integrating any APIs with the Bearer client for Python

Installing & initializing

Python
pip install bearer
Python
# Initialize the client with your Bearer API key
from bearer import Bearer
bearer = Bearer(BEARER_API_KEY)

Replace the BEARER_API_KEY respectively with your API Key and Encryption Key that can be found on your Developer Keys page.

Calling APIs

Python
# GET call
bearer.integration('github') \
.get('/repositories', { query: { since: 364 } })
# GET call with a custom SetupId
bearer.integration('github') \
.setup(SETUP_ID)
.get('/repositories', { query: { since: 364 } })
# POST call with OAuth
bearer.integration('github') \
.auth(authId) \
.post('/user/repos', { body: { name: 'Just setting up my Bearer.sh' } })
# GET call with a custom header
bearer.integration('github')
.setup(SETUP_ID)
.get('/repositories', { headers: { accept: "application/json" }, query: { since: 364 } })

Check out the source of the Python client.