Skip to main content

A python SDK that wraps Bio-T Open API

Project description

Biot Python SDK

Introduction

The Biot Python SDK is a comprehensive toolkit designed to interact seamlessly with the Bio-T Open API. It provides easy-to-use classes for authentication, data retrieval, system health checks, and report management.

This SDK is ideal for developers looking to integrate Bio-T’s system into their applications, enabling quick and efficient API interactions.


Installation

Before using the SDK, install the required dependencies:

pip install -r requirements.txt

or directly install the package:

pip install biot_python_sdk

Quick Start

Here’s a simple example:

from biot_python_sdk import APIClient, BiotClient

# Initialize API client
api_client = APIClient("https://api.dev.xtrodes1.biot-med.com")

# Authenticate using username and password
biot_client = BiotClient(api_client, username="your_username", password="your_password")
token = biot_client.login()

# Check system health
is_healthy = biot_client.is_system_healthy('/settings/system/healthCheck')
print(f"System Healthy: {is_healthy}")

Class Documentation

1. APIClient (Handles HTTP Requests)

Attributes

Attribute Description
base_url The base URL of the Biot API (e.g., "https://api.dev.xtrodes1.biot-med.com")
headers Default headers for requests (including authentication token)
retry_count Number of request retries in case of failure

Methods

make_request(endpoint: str, method: str = 'GET', data: dict = None, params: dict = None, headers: dict = None) -> dict

  • Sends an HTTP request and handles retries/errors.

Example:

response = api_client.make_request("/settings/system/healthCheck")

2. BiotClient (Handles Authentication & Base API Functions)

Attributes

Attribute Description
api_client Instance of APIClient
username Bio-T account username
password Bio-T account password
auth_token Stores authentication token

Methods

login() -> str

  • Authenticates user and retrieves API token.
token = biot_client.login()

is_system_healthy(endpoint: str) -> bool

  • Checks if the system is running correctly.
is_healthy = biot_client.is_system_healthy('/settings/system/healthCheck')

3. DataManager (File and Data Management)

Attributes

Attribute Description
biot_client Instance of BiotClient

Methods

get_session_by_uuid(uuid: str) -> dict

  • Retrieves session details by UUID.
session_data = data_manager.get_session_by_uuid("123e4567-e89b-12d3-a456-426614174000")

upload_file(filepath: str) -> str

  • Uploads a file to Bio-T.
file_id = data_manager.upload_file("data.csv")

create_generic_entity(entity_name: str, entity_data: dict) -> dict

  • Creates a new Generic Entity (GE).
entity = data_manager.create_generic_entity("NewEntity", {"key": "value"})

update_generic_entity(entity_id: str, entity_data: dict) -> dict

  • Updates existing GE.
updated_entity = data_manager.update_generic_entity("entity123", {"key": "new_value"})

4. ReportManager (Handles Reports & Config Snapshots)

Attributes

Attribute Description
data_manager Instance of DataManager

Methods

export_full_configuration_snapshot(report_name: str) -> str

  • Exports a full configuration snapshot.
snapshot_id = report_manager.export_full_configuration_snapshot("Snapshot_ABC")

get_report_file_by_name(report_name: str) -> dict

  • Retrieves report file details.
report_data = report_manager.get_report_file_by_name("Snapshot_ABC")

import_configuration_snapshot(snapshot_file: str) -> bool

  • Imports a configuration snapshot.
success = report_manager.import_configuration_snapshot("Snapshot_ABC.json")

Environment Variables Setup

For security, store credentials in an .env file, for example:

biot_username=your_email@domain.com
biot_password=your_secure_password
biot_endpoint=https://api.dev.xtrodes1.biot-med.com

Running Tests

Run the full test suite:

pytest

Contributing

We welcome community contributions! Here’s the workflow:

  1. Fork the repository.
  2. Create a feature branch.
  3. Implement changes & tests.
  4. Submit a pull request.

License

This project is licensed under the MIT License.


Support

For questions, contact Stanislav Steinberg at: 📧 sstbrg@gmail.com


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

biot_python_sdk-1.0.20.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

biot_python_sdk-1.0.20-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file biot_python_sdk-1.0.20.tar.gz.

File metadata

  • Download URL: biot_python_sdk-1.0.20.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for biot_python_sdk-1.0.20.tar.gz
Algorithm Hash digest
SHA256 18c8cd5bc21bfa0ef5a9510b67c85ea441cb337baef4569e0d21c4979e70f68d
MD5 a546d7c3cca5fc56d70de35e2ee8e86e
BLAKE2b-256 39c019360fb7fef0b4eb1b6c7fb41fc0f01852502fd2a8c38e283ecce42f9d4c

See more details on using hashes here.

File details

Details for the file biot_python_sdk-1.0.20-py3-none-any.whl.

File metadata

File hashes

Hashes for biot_python_sdk-1.0.20-py3-none-any.whl
Algorithm Hash digest
SHA256 ef3592ceed08166ee66b33c693b66a0e9bce1d47e8a4e036afd1af7e9135748d
MD5 76c51b2d41b10e2cda890d76f66245d7
BLAKE2b-256 4db4f4b07b49f4c764852cb6d3ddb65eb7d610e63a9f36c1e6b8c351677acc6b

See more details on using hashes here.

Supported by

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