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:
- Fork the repository.
- Create a feature branch.
- Implement changes & tests.
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file biot_python_sdk-1.0.18-py3-none-any.whl.
File metadata
- Download URL: biot_python_sdk-1.0.18-py3-none-any.whl
- Upload date:
- Size: 15.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aafe050afcb9606a16747dced2276317ddd91408b2632d8b6148608b87109dea
|
|
| MD5 |
07678f4643dc5a179a01df33ef819a79
|
|
| BLAKE2b-256 |
b0a016c1f735607e0c1082facc6ba6ffcc0e8113cb86630e2ecabf909a2fd0d7
|