Skip to main content

Python SDK for BoardsOnFire API

Project description

BoardsOnFire Python Client

Overview

The BoardsOnFireClient is a Python package that provides a convenient interface to interact with the BoardsOnFire API. It allows developers to easily manage organizations, users, entities, and data sources within the BoardsOnFire ecosystem.

Installation

You can install the package using pip:

pip install boardsonfire-client

Usage

Initialization

To use the client, you need to initialize it with your domain and API key:

from boardsonfire_client import BoardsOnFireClient

client = BoardsOnFireClient(domain='your-domain', api_key='your-api-key')

Working with Organizations

You can list, retrieve, and manage organizations using the Organizations class.

List Organizations

# List organizations with pagination
organizations = client.organizations.list(page_size=50, page=1)

# List all organizations
for org in client.organizations.list_all(limit=100):
    print(org)

Get an Organization by ID

organization = client.organizations.get(id='organization-id')
print(organization)

Working with Users

The Users class allows you to manage users within your BoardsOnFire instance.

List Users

# List users with pagination
users = client.users.list(page_size=100, page=1)

# List all users
for user in client.users.list_all(limit=100):
    print(user)

Get a User by ID

user = client.users.get(id='user-id')
print(user)

Working with Entities

The Entities class provides methods to manage entity objects.

List Entities

# List entity objects with pagination
entities = client.entities.list(entity_name='entity-name', page_size=100, page=1)

# List all entity objects
for entity in client.entities.list_all(entity_name='entity-name', limit=100):
    print(entity)

Get an Entity by ID

entity = client.entities.get(entity_name='entity-name', id='entity-id')
print(entity)

Create an Entity

new_entity = {
    "organization_id": "organization-id",
    # other fields
}
created_entity = client.entities.create(entity_name='entity-name', data=new_entity)
print(created_entity)

Update an Entity

updated_entity_data = {
    "id": "entity_id",
    "field_to_update": "new-value",
    # other fields
}
updated_entity = client.entities.update(entity_name='entity-name', id='entity-id', data=updated_entity_data)
print(updated_entity)

Delete an Entity

client.entities.delete(entity_name='entity-name', id='entity-id')

Working with Data Sources

The DataSources class allows you to manage data objects within data sources.

List Data Objects

# List data objects with pagination
data_objects = client.datasources.list(datasource_name='datasource-name', page_size=100, page=1)

# List all data objects
for data in client.datasources.list_all(datasource_name='datasource-name', limit=100):
    print(data)

Get a Data Object by ID

data_object = client.datasources.get(datasource_name='datasource-name', id='data-id')
print(data_object)

Create a Data Object

new_data = {
    "organization_id": "organization-id",
    "timestamp": "2023-01-01T00:00:00Z",
    # other fields
}
created_data = client.datasources.create(datasource_name='datasource-name', data=new_data)
print(created_data)

Update a Data Object

updated_data = {
    "field_to_update": "new-value",
    # other fields
}
updated_data_object = client.datasources.update(datasource_name='datasource-name', id='data-id', data=updated_data)
print(updated_data_object)

Delete a Data Object

client.datasources.delete(datasource_name='datasource-name', id='data-id')

Error Handling

The client raises custom exceptions to handle various error scenarios:

  • RateLimitException: Raised when the rate limit is exceeded.
  • NotFoundException: Raised when the requested resource is not found.
  • RestClientException: Raised for other unsuccessful responses or invalid JSON in the response.

Example:

try:
    users = client.users.list(page_size=100, page=1)
except RateLimitException as e:
    print("Rate limit exceeded:", e)
except RestClientException as e:
    print("An error occurred:", e)

try:
    users = client.users.get(id='user_id')
except NotFoundException as e:
    print("User not found:", e)

Logging

You can pass a custom logger to the client for logging purposes:

import logging

logger = logging.getLogger('boardsonfire_client')
client = BoardsOnFireClient(domain='your-domain', api_key='your-api-key', logger=logger)

Contributing

Contributions are welcome! Please submit a pull request or open an issue to discuss any changes.

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

boardsonfire_sdk-0.0.1.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

boardsonfire_sdk-0.0.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file boardsonfire_sdk-0.0.1.tar.gz.

File metadata

  • Download URL: boardsonfire_sdk-0.0.1.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for boardsonfire_sdk-0.0.1.tar.gz
Algorithm Hash digest
SHA256 66ba5839bf6f1b59e09ef7c0d2835c3e890aed01791cd78044e44f16a1e83ead
MD5 7e3e49e57b34724c3fed368bb7f3b05e
BLAKE2b-256 a0f4d9899f03d73c333ea99e4ede94cace0f5991833393d9eaa2c162d15c6c70

See more details on using hashes here.

File details

Details for the file boardsonfire_sdk-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for boardsonfire_sdk-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d9f0f0d90ec19e46999a5114b25cab8c1564dd7cd9be41d3f7a8f7c676804f44
MD5 f77d9bc16f480c34159d6939f1924e58
BLAKE2b-256 4eeed064f08539c7b0455980e4f715f8d16201bbef7df5637b4d2cb4209fa46e

See more details on using hashes here.

Supported by

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