An async client for Gundi's API
Project description
Gundi Client
Introduction
Gundi, a.k.a "The Portal" is a platform to manage integrations. The gundi-client is an async python client to interact with Gundi's REST API.
Installation
pip install gundi-client
Usage
from gundi_client import PortalApi
import httpx
# You can use it as an async context-managed client
async with PortalApi() as portal:
try:
response = await portal.get_outbound_integration_list(
session=session, inbound_id=str(inbound_id), device_id=str(device_id)
)
except httpx.RequestError as e:
logger.exception("Request Error")
...
except httpx.TimeoutException as e:
logger.exception("Request timed out")
...
except httpx.HTTPStatusError as e:
logger.exception("Response returned error")
else:
# response contains a list configs as dicts
for integration in response:
...
...
# Or create an instance and close the client explicitly later
portal = PortalApi()
try:
response = await portal.get_outbound_integration_list(
session=session, inbound_id=str(inbound_id), device_id=str(device_id)
)
except httpx.RequestError as e:
logger.exception("Request Error")
...
except httpx.TimeoutException as e:
logger.exception("Request timed out")
...
except httpx.HTTPStatusError as e:
logger.exception("Response returned error")
else:
# response contains a list configs as dicts
for integration in response:
...
...
await portal.close() # Close the session used to send requests to ER API
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
gundi_client-1.0.2.tar.gz
(8.6 kB
view details)
Built Distribution
File details
Details for the file gundi_client-1.0.2.tar.gz
.
File metadata
- Download URL: gundi_client-1.0.2.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a73f1ab324decfb26f66c7031321339c8f51691db1f187818836aee1795ece0 |
|
MD5 | 2ff7698bf446d02130221ffc2d167339 |
|
BLAKE2b-256 | fa8ad6b61f66e83c4abc9b9114d62a2614c000e5e0612bfd33d71a64c5950674 |
Provenance
File details
Details for the file gundi_client-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: gundi_client-1.0.2-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c5b10b5103fb6df8c4e35f367e450dec22a011f609105859504a7c7a6251f6b |
|
MD5 | 8cd070d3f20a6fa3947f3be4368a2fd7 |
|
BLAKE2b-256 | 2c62bea917c685087d4955037d0d8698c6bb768b7db78bd9c2dd6d0aa6d9c0c9 |