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/*
Release files for rehive 1.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rehive-1.4.0.tar.gz | 15.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rehive-1.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 35.7 kB
Release files / rehive-1.4.0.tar.gz
| Download URL | rehive-1.4.0.tar.gz |
|---|---|
| Size | 15.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fedd4900fc69254ec24ae3041a3effc8c76becbab8a5150a744c2f2103ec8a1f
|
|
BLAKE2b-256 checksum How to use checksums |
365b7b8ff3d956b282aa414e1b686963e35fe41e973bf8a68ff7092ef6c70436
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|
Release files / rehive-1.4.0-py3-none-any.whl
| Download URL | rehive-1.4.0-py3-none-any.whl |
|---|---|
| Size | 20.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
927a9f831549771dc74f4606b01262b63401c62c330db46ba65175dc0a51b8ad
|
|
BLAKE2b-256 checksum How to use checksums |
1e79a0654a6264ae1f1a66d8b080c92d69115554bf6a891b4b9e69feae88ef75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|