Skip to main content

Rehive SDK for Python

Project description

# Rehive Python SDK
A tool primarly used for quick interfacing with the Rehive API.


## Install
```
pip install rehive
```

## Documentation

For more in depth api details go to: http://docs.rehive.com/

## Examples And How-to

```python
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.

The SDK will default to the live API. To easily switch to staging there is a network flag:
```python
rehive = Rehive(network='staging')
```


Login:
```python
rehive.auth.login(
user="test@rehive.com",
company="test_company",
password="12345678"
)
```

Get:
```python
rehive.admin.accounts.get()
```

Get nested objects:
```python
rehive.admin.accounts.obj('5AT24mW61H').currencies.get()
```

Get with filters:
```python
rehive.admin.transactions.get(filters={"status":"confirmed"})
```

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

Patch/Put:
```python
rehive.admin.company.switches.patch('1', enabled=True) # Patch switch with identifier 1
```

Pagination:
```python
rehive.admin.currencies.get()
rehive.admin.currencies.get_next()
rehive.admin.currencies.get_previous()
```


## Exception And Error Handling

```python
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

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

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.1.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

rehive-1.1.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rehive-1.1.0.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for rehive-1.1.0.tar.gz
Algorithm Hash digest
SHA256 3bd847be9cda158c95e299f738fced519e864d378c2ad85444658aeafdcc9580
MD5 407ed040516867df1e5716f7fe564862
BLAKE2b-256 b9d6dd016e200201debb3c687f9b9df39ba8cdd8bf00cd1aaaf55ddd645a2bc6

See more details on using hashes here.

File details

Details for the file rehive-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for rehive-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c886b2a29ce445636b078453e6a1fb48115484a901b41cce2c5391b79a3bde5c
MD5 34e855caff0b34acaff972fb8ad62579
BLAKE2b-256 55016a55ae035de27426b8ab1b40dcadb903d05f6869a3fc2003476648664e9a

See more details on using hashes here.

Supported by

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