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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for biot_python_sdk-1.0.19-py3-none-any.whl
Algorithm Hash digest
SHA256 c9c27591ae40482a6ed7fa6d55918bdfa00a24ea34bf36196adf22142f83bbe5
MD5 f38fa96d8142b61c34d8c831a2ab830b
BLAKE2b-256 678f15c596b25005b214e6129553b3040dcacc90d86f052b838b07509da294b7

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