Skip to main content

Rehive SDK for Python

Project description

Rehive Logo

Rehive Python SDK

A Python SDK for the Rehive Platform API.

Installation

pip install rehive

Documentation

For documentation on the Rehive ecosystem: Docs Portal

For the full Rehive Platform API specification: API Reference

Usage

from rehive import Rehive, APIException
rehive = Rehive()  # OR Rehive(API_TOKEN_HERE)

You can parse an api token or leave blank if manually logging in. Each object instance will store it's own token and act as another user.

Auth:

rehive = Rehive(REHIVE_API_KEY)

Get:

rehive.admin.accounts.get()

Get nested objects:

rehive.admin.accounts.obj('5AT24mW61H').currencies.get()

Get with filters:

rehive.admin.transactions.get(filters={"status":"complete"})

Create:

rehive.admin.users.emails.create('1d3e584d-ac56-483c-8aa5-d4ef059608ba', 'connor+899@rehive.com', verified=True)

Patch/Put:

rehive.admin.company.switches.patch('1', enabled=True) # Patch switch with identifier 1

Pagination:

rehive.admin.currencies.get()
rehive.admin.currencies.get_next()
rehive.admin.currencies.get_previous()

Exception And Error Handling

from rehive import APIException

try:
  rehive.admin.currencies.get()
except APIException as e:
  print(e.status_code) # Error code status code from Rehive
  print(e.data) # Any custom error messages and data returned from Rehive

Idempotent requests

rehive.user.update(last_name='test7777', idempotent_key='{UNIQUE_KEY}')

Development

Generate a python package.

python setup.py sdist

Install twine if you have not done so already.

pip install twine

Upload the python package:

twine upload dist/*

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

rehive-1.3.9.tar.gz (12.2 kB view details)

Uploaded Source

File details

Details for the file rehive-1.3.9.tar.gz.

File metadata

  • Download URL: rehive-1.3.9.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.13

File hashes

Hashes for rehive-1.3.9.tar.gz
Algorithm Hash digest
SHA256 6b0841d69b7c7117c79bcb2dc90e0ffdc0415861e380d8f95e2acccba34c5acd
MD5 e2f9d8818f492319caa78e2678f8b948
BLAKE2b-256 ccea2c47396c1afeef2b24f444f0396610985decab20ef354669ccdbacd48e18

See more details on using hashes here.

Supported by

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