Bearer API client for Python

Overview

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
You might also like...
Python Client for Instagram API

This project is not actively maintained. Proceed at your own risk! python-instagram A Python 2/3 client for the Instagram REST and Search APIs Install

A Python Client for News API

newsapi-python A Python client for the News API. License Provided under MIT License by Matt Lisivick. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRAN

SmartFile API Client (Python).
SmartFile API Client (Python).

A SmartFile Open Source project. Read more about how SmartFile uses and contributes to Open Source software. Summary This library includes two API cli

Python client for the Socrata Open Data API

sodapy sodapy is a python client for the Socrata Open Data API. Installation You can install with pip install sodapy. If you want to install from sour

Python client for the Echo Nest API
Python client for the Echo Nest API

Pyechonest Tap into The Echo Nest's Musical Brain for the best music search, information, recommendations and remix tools on the web. Pyechonest is an

A Python Tumblr API v2 Client

PyTumblr Installation Install via pip: $ pip install pytumblr Install from source: $ git clone https://github.com/tumblr/pytumblr.git $ cd pytumblr $

A super awesome Twitter API client for Python.

birdy birdy is a super awesome Twitter API client for Python in just a little under 400 LOC. TL;DR Features Future proof dynamic API with full REST an

Cord Python API Client

Cord Python API Client The data programming platform for AI 💻 Features Minimal low-level Python client that allows you to interact with Cord's API Su

Pure Python 3 MTProto API Telegram client library, for bots too!

Telethon ⭐️ Thanks everyone who has starred the project, it means a lot! Telethon is an asyncio Python 3 MTProto library to interact with Telegram's A

Comments
  • Add auth details fetching

    Add auth details fetching

    Adds get_auth method to allow fetching auth details in a user-friendly way.

    Also fixes tests that were using the wrong keyword arg name for asserting request headers.

    opened by didroe 0
  • Logging

    Logging

    Allows to set basic logging for Bearer Python client.

    You can set the logger level using the following syntax (defaults to logging.INFO) :

    import logging
    from bearer import logger
    
    logger.setLevel(logging.DEBUG)
    

    By default each request will produce the following log entry:

    2019-10-16 14:54:27,116 - bearer - INFO - request id: 1-5da71302-a9230375efae6a1b9303c35c
    

    For logging.DEBUG you will get the following log entry

    2019-10-16 14:52:27,507 - bearer - DEBUG - sending request
        url: https://proxy.staging.bearer.sh/postman_echo/get
        method: GET
        params: None
        body: None
        headers: {'Authorization': 'sk_production_Xs3hErAxOajxayx7PD7eT9WamrHRtW6p', 'User-Agent': 'Bearer-Python (2.0.0)'}
        http_client_settings: {'timeout': 5}
    2019-10-16 14:52:28,505 - bearer - INFO - request id: 1-5da7128b-0db046accec92704a18f01f8
    
    opened by RadekMolenda 0
  • Proxy rewrite

    Proxy rewrite

    This is a breaking change

    • Stop using old url and start using proxy url
    • unify the bearer client interface:
      • deprecate integartion_host & timeout
      • prefer using host & http_client_settings
    opened by RadekMolenda 0
  • Reimplement client

    Reimplement client

    Reimplements the client for parity with libs in other languages.

    from bearer import Bearer
    
    bearer = Bearer('<apiKey>')
    
    # Invoke a function using OAuth
    bearer.invoke('<buid>', '<functionName>', params={ 'authId': '<authId>' })
    
    # For a function using Basic/API Key auth
    bearer.invoke('<buid>', '<functionName>', params={ 'setupId': '<setupId>' })
    
    opened by didroe 0
Releases(release-v3.1.0)
Owner
Bearer
Automate data security risk assessment for cloud-native applications.
Bearer
This bot will delete messages containing blacklisted words in your telegram groups.

Profanity Detector Bot This bot will delete messages containing blacklisted words in your telegram groups. Made using ProfanityDetector.

Aditya 17 Oct 08, 2022
Anti-corruption-bot - Anti corruption bot with python

anti-corruption-bot Test API (running via Flask) is currently hosted at https://

Richard Bankole 2 Feb 16, 2022
Linky bot, A open-source discord bot that allows you to add links to ur website, youtube url, etc for the people all around discord to see!

LinkyBot Linky bot, An open-source discord bot that allows you to add links to ur website, youtube url, etc for the people all around discord to see!

AlexyDaCoder 1 Sep 20, 2022
TwitchAccountMaker - Twitch Account Maker with python

Twitch Account Creator A Twitch Account Creator, Requires Capmonster.cloud Verif

vanis / 1800 0 Jan 20, 2022
wyscoutapi is an extremely basic API client for the Wyscout API (v2 & v3) for Python

wyscoutapi wyscoutapi is an extremely basic API client for the Wyscout API (v2 & v3). Usage Install with pip install wyscoutapi. To connect to the Wys

Ben Torvaney 11 Nov 22, 2022
Posts word definitions on Twitter daily

Word Of The Day bot Post daily word definitions on social media. Twitter account: https://twitter.com/WordOfTheDay_B Introduction The goal of this pro

Lucas Rijllart 1 Jan 08, 2022
A powerful discord bot for forming team.

Discord_SquadBot A powerful discord bot for forming team. Pre-requirement Python 3.7 and latest Discord.py module is required. Installation guideline

Jacky Yu 2 Jan 29, 2022
A powerful application to automatically deploy GitHub Release.

A powerful application to automatically deploy GitHub Release.

Fentaniao 43 Sep 17, 2022
Baby Villager Bot

This script scrapes and stores the availability of timeslots for Car Driving Test at all RTA Serivce NSW centres in the state. Dependencies Account wi

Milo Weinberg 3 Dec 16, 2021
An automated, headless YouTube Uploader

An automated, headless YouTube Uploader Authors: Christian C., Moritz M., Luca S. Related Projects: YouTube Watcher, Twitch Compilation Creator, Neura

127 Dec 23, 2022
A Python Program to determine Degree of Profanity of Tweets

tweetx tweetx is a program to detect racial slurs in Twitter Tweets. Racial Abuse on Twitter is becoming quite a serious issue in recent times. tweetx

Kartik Poojari 3 Nov 11, 2021
⬇️ Telegram Bot to download TikTok videos without watermark in a snap with Inline mode support.

⬇️ Tokmate - Telegram Bot to download TikTok videos ⛲ Features Superfast and supports all type of TikTok links Download any TikTok videos without mate

Hemanta Pokharel 35 Jan 05, 2023
Randomly selects two teams based on who is in a voice channel on Discord

TeamPickerDiscordBot Randomly selects two teams based on who is in a voice channel on Discord What I Learned The ins and outs of Python as this was my

Brecken Enneking 2 Jan 27, 2022
A library for demo trading | backtest and forward test simulation

Trade Engine a library for demo trading | backtest and forward test simulation Features Limit/Market orders: you can place a Limit or Market order in

Ali Moradi 7 Jul 02, 2022
This solution helps you deploy Data Lake Infrastructure on AWS using CDK Pipelines.

CDK Pipelines for Data Lake Infrastructure Deployment This solution helps you deploy data lake infrastructure on AWS using CDK Pipelines. This is base

AWS Samples 66 Nov 23, 2022
Trading strategy for the Freqtrade crypto bot

NostalgiaForInfinity Trading strategy for the Freqtrade crypto bot Change strategy Add strategies to the user_data/strategies folder and also in the d

iterativ 1.5k Jan 01, 2023
TgMusicBot is a telegram userbot for playing songs in telegram voice calls based on Pyrogram and PyTgCalls.

TgMusicBot [Stable] TgMusicBot is a telegram userbot for playing songs in telegram voice calls based on Pyrogram and PyTgCalls. Commands !start / !hel

Kürşad 21 Dec 25, 2022
A Bot to get RealTime Tweets to a Specific Chats from Desired Persons on Twitter to Telegram Chat.

TgTwitterStreamer A Bot to get RealTime Tweets to a Specific Chats from Desired Persons on Twitter to Telegram Chat. For Getting ENV's Refer this Link

Anonymous 69 Dec 20, 2022
A module to complement discord.py that has Music, Paginator and Levelling.

discord-super-utils A modern python module including many useful features that make discord bot programming extremely easy. Features Modern leveling m

Yash 106 Dec 19, 2022
Python implementation of Spotify's authorization flow.

Spotify API Apps 🎷 🎶 🎼 This repository consists of many strange codes that make you think why the hell this guy doing this. Well... I got some reas

5 Dec 17, 2021