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 code is for a bot which will find a Twitter user's most tweeted word and tweet that word, tagging said user

max_tweeted_word This code is for a bot which will find a Twitter user's most tweeted word and tweet that word, tagging said user The program uses twe

Yasho Bapat 1 Nov 29, 2021
Reddit cli to slack at work

Reddit CLI (v1.0) Introduction Why Reddit CLI? Coworker who sees me looking at something in a browser: "Glad you're not busy; I need you to do this, t

3 Jun 22, 2021
Telegram bot with various Sticker Tools

Sticker Tools Bot @Sticker_Tools_Bot A star โญ from you means a lot to us! Telegram bot with various Sticker Tools Usage Deploy to Heroku Tap on above

Stark Bots 20 Dec 08, 2022
A continued fork of Disco

Orca Orca is an extensive and extendable Python 3.x library for the Discord API. orca boasts the following major features: Expressive, functional inte

RPS 4 Apr 03, 2022
A robust, low-level connector for the Discord API

Bauxite Bauxite is a robust, low-level connector for the Discord API. What is Bauxite for? Bauxite is made for two main purposes: Creating higher-leve

1 Dec 04, 2021
PyLyrics Is An [Open-Source] Bot That Can Help You Get Song Lyrics

PyLyrics-Bot Telegram Bot To Search Song Lyrics From Genuis. ๐Ÿค– Demo: ๐Ÿ‘จโ€๐Ÿ’ป Deploy: โค Deploy Your Own Bot : Star ๐ŸŒŸ Fork ๐Ÿด & Deploy -Easy Way -Self-h

DAMIEN 12 Nov 12, 2022
Repository for the IPvSeeYou talk at Black Hat 2021

IPvSeeYou Geolocation Lookup Tool Overview IPvSeeYou.py is a tool to assist with geolocating EUI-64 IPv6 hosts. It takes as input an EUI-64-derived MA

57 Nov 08, 2022
A high level library for building Discord bots.

Qord A high level library for building Discord bots. ๐Ÿšง This library is currently in development. Questions that you are having What is this? This is

Izhar Ahmad 16 May 14, 2022
Data from popular CS:GO website hltv.org

Welcome to hltv-data ๐Ÿ‘‹ ๐ŸŽฎ Data from popular CS:GO website hltv.org Install pip install hltv-data Usage The public methods can be reached using HLTVCl

Dariusz Choruลผy 28 Dec 23, 2022
A modified Sequential and NLP based Bot

A modified Sequential and NLP based Bot I improvised this bot a bit with some implementations as a part of my own hobby project :) Note: I do not own

Jay Desale 2 Jan 07, 2022
Seth Userbot with python

SETH-USERBOT DEPLOY TO HEROKU Group Support: String Session : Stay Support ๐Ÿš€ โ LonamiWebs and Telethon ยฉ Credits โšก THANK YOU VERY MUCH FOR zeinzo Zei

seth 4 Jan 10, 2022
8300-account-nuker - A simple accoutn nuker or can use it full closing dm and leaving server

8300 ACCOUNT NUKER VERISON: its just simple accoutn nuker or can use it full clo

โ€ โ€  5 Jan 26, 2022
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
Support for Competitive Coding badges to add in Github readme or portfolio websites.

Support for Competitive Coding badges to add in Github readme or portfolio websites.

Akshat Aggarwal 2 Feb 14, 2022
Mixcloud API wrapper for Python and Async IO

aiomixcloud Mixcloud API wrapper for Python and Async IO aiomixcloud is a wrapper library for the HTTP API of Mixcloud. It supports asynchronous opera

Aristotelis Mikropoulos 26 Dec 31, 2022
AWS Enumeration and Footprinting Tool

Quiet Riot ๐ŸŽถ C'mon, Feel The Noise ๐ŸŽถ An enumeration tool for scalable, unauthenticated validation of AWS principals; including AWS Acccount IDs, roo

Wes Ladd 89 Jan 05, 2023
Telegram bot for stream music or video on telegram

KYURA MUSIC Telegram bot for stream music or video on telegram, powered by PyTgCalls and Pyrogram Help Need Help me to translate this repo, click the

0 Dec 08, 2022
A Python wrapper around the Soundcloud API

soundcloud-python A friendly wrapper around the Soundcloud API. Installation To install soundcloud-python, simply: pip install soundcloud Or if you'r

SoundCloud 83 Dec 12, 2022
A simple Discord Token Grabber sending the new token if the victim changes his password.

๐Ÿ’Ž Riot ๐Ÿ’Ž Riot is a simple Discord token grabber written in Python3 running in background and executing when the victim start their computer. If the

Billy 66 Dec 26, 2022
Pinopoly is a tool to remove the "banker" player and replace them with a digitalized system

Pinopoly is a tool to remove the "banker" player and replace them with a digitalized system. It is intended to be used on a Raspberry Pi but can be used in the command line as well.

Alex Overstreet 11 Jul 09, 2022