<p align="center">
<img width="64" src="https://avatars2.githubusercontent.com/u/22204821?s=200&v=4" alt="Rehive Logo">
<h1 align="center">Rehive Python SDK</h1>
<p align="center">A Python SDK for the Rehive Platform API.</p>
</p>
## Installation
```shell
pip install rehive
```
## Documentation
For documentation on the Rehive ecosystem: [Docs Portal](https://docs.rehive.com/)
For the full Rehive Platform API specification: [API Reference](https://docs.platform.rehive.com/)
## Usage
```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.
Auth:
```python
rehive = Rehive(REHIVE_API_KEY)
```
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":"complete"})
```
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}')
```
## Development
Generate a python package.
```shell
python setup.py sdist
```
Install `twine` if you have not done so already.
```shell
pip install twine
```
Upload the python package:
```shell
twine upload dist/*
```
Raw data
{
"_id": null,
"home_page": "https://github.com/rehive/rehive-python",
"name": "rehive",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.4",
"maintainer_email": "",
"keywords": "rehive api sdk development",
"author": "Rehive",
"author_email": "info@rehive.com",
"download_url": "https://files.pythonhosted.org/packages/f4/89/4ffe2d64e6ba522c6916d7ecfd4c1103c5b4297637b0e9cc5f9e5b55fe9e/rehive-1.3.5.tar.gz",
"platform": null,
"description": "<p align=\"center\">\n <img width=\"64\" src=\"https://avatars2.githubusercontent.com/u/22204821?s=200&v=4\" alt=\"Rehive Logo\">\n <h1 align=\"center\">Rehive Python SDK</h1>\n <p align=\"center\">A Python SDK for the Rehive Platform API.</p>\n</p>\n\n## Installation\n\n```shell\npip install rehive\n```\n\n## Documentation\n\nFor documentation on the Rehive ecosystem: [Docs Portal](https://docs.rehive.com/)\n\nFor the full Rehive Platform API specification: [API Reference](https://docs.platform.rehive.com/)\n\n## Usage\n\n```python\nfrom rehive import Rehive, APIException\nrehive = Rehive() # OR Rehive(API_TOKEN_HERE)\n```\nYou 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.\n\nAuth:\n\n```python\nrehive = Rehive(REHIVE_API_KEY)\n```\n\nGet:\n\n```python\nrehive.admin.accounts.get()\n```\n\nGet nested objects:\n\n```python\nrehive.admin.accounts.obj('5AT24mW61H').currencies.get()\n```\n\nGet with filters:\n\n```python\nrehive.admin.transactions.get(filters={\"status\":\"complete\"})\n```\n\nCreate:\n\n```python\nrehive.admin.users.emails.create('1d3e584d-ac56-483c-8aa5-d4ef059608ba', 'connor+899@rehive.com', verified=True)\n```\n\nPatch/Put:\n\n```python\nrehive.admin.company.switches.patch('1', enabled=True) # Patch switch with identifier 1\n```\n\nPagination:\n\n```python\nrehive.admin.currencies.get()\nrehive.admin.currencies.get_next()\nrehive.admin.currencies.get_previous()\n```\n\n\n### Exception And Error Handling\n\n```python\nfrom rehive import APIException\n\ntry:\n rehive.admin.currencies.get()\nexcept APIException as e:\n print(e.status_code) # Error code status code from Rehive\n print(e.data) # Any custom error messages and data returned from Rehive\n```\n\n### Idempotent requests\n\n```python\nrehive.user.update(last_name='test7777', idempotent_key='{UNIQUE_KEY}')\n```\n\n## Development\n\nGenerate a python package.\n\n```shell\npython setup.py sdist\n```\n\nInstall `twine` if you have not done so already.\n\n```shell\npip install twine\n```\n\nUpload the python package:\n\n```shell\ntwine upload dist/*\n```\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Rehive SDK for Python",
"version": "1.3.5",
"project_urls": {
"Download": "https://github.com/rehive/rehive-python/archive/1.3.5.zip",
"Homepage": "https://github.com/rehive/rehive-python"
},
"split_keywords": [
"rehive",
"api",
"sdk",
"development"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f4894ffe2d64e6ba522c6916d7ecfd4c1103c5b4297637b0e9cc5f9e5b55fe9e",
"md5": "625833dcac6519daf13627963c5c0579",
"sha256": "9c1f7a278e7293d7d91ab2223346ee01f1809a89160082d48ca4769fde44d847"
},
"downloads": -1,
"filename": "rehive-1.3.5.tar.gz",
"has_sig": false,
"md5_digest": "625833dcac6519daf13627963c5c0579",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.4",
"size": 12116,
"upload_time": "2023-09-05T14:03:39",
"upload_time_iso_8601": "2023-09-05T14:03:39.219518Z",
"url": "https://files.pythonhosted.org/packages/f4/89/4ffe2d64e6ba522c6916d7ecfd4c1103c5b4297637b0e9cc5f9e5b55fe9e/rehive-1.3.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-05 14:03:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "rehive",
"github_project": "rehive-python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "rehive"
}