Python client SDK for the BCIC API
Project description
BCIC Client API
Python client SDK for the BCIC API.
Overview
bcic-client-api provides a typed Python interface for interacting with BCIC through:
- session authentication
- API key authentication
- record operations
- user, role, and permission queries
- binary and lower-level REST method access
The public entry point is bcic.Client.
Requirements
- Python 3.12+
- A reachable BCIC tenant base URL
Installation
pip install bcic-client-api
Quick Start
Session authentication
from bcic import Client
client = Client(
base_url="https://your-bcic-tenant.example.com",
username="your-username",
password="your-password",
)
client.authenticate()
try:
records = client.records.list_all("YourViewId")
print(records)
finally:
client.logout()
client.close()
API key authentication
from bcic import Client
client = Client(
base_url="https://your-bcic-tenant.example.com",
auth_mode="api_key",
api_key="your-api-key",
)
result = client.methods.execute("getRoles")
print(result)
client.close()
Context manager
from bcic import Client
with Client(
base_url="https://your-bcic-tenant.example.com",
username="your-username",
password="your-password",
) as client:
client.authenticate()
user_roles = client.users.list_roles()
print(user_roles)
Environment Variables
Client.from_env() can build a configured client from environment values.
Supported variables:
BCIC_BASE_URLBCIC_USERNAMEBCIC_PASSWORDBCIC_AUTH_MODEBCIC_API_KEYBCIC_API_KEY_HEADERBCIC_TIMEOUTBCIC_MAX_RETRIESBCIC_RETRY_WAIT_SECONDSBCIC_OUTPUT_FORMAT
Example:
from bcic import Client
client = Client.from_env()
Public API
Client
The client exposes these domain endpoints:
client.recordsclient.usersclient.binaryclient.methods
Common lifecycle methods:
client.authenticate()client.logout()client.close()
Records
record = client.records.get("ObjectName", "RecordId")
page = client.records.get_page("ViewId", page_size=100)
items = client.records.list_all("ViewId")
created = client.records.create("ObjectName", {"Field1": "value"})
updated = client.records.update("ObjectName", "RecordId", {"Field1": "new value"})
deleted = client.records.delete("ObjectName", "RecordId")
Users
roles = client.users.list_roles()
role = client.users.get_role("RoleId")
permissions = client.users.get_permissions_by_role("RoleId", "object")
user_permissions = client.users.get_permissions_by_user("UserId", "menu", application_id="AppId")
Methods
Use client.methods.execute() for controlled lower-level REST method access when a domain-specific helper is not available.
payload = client.methods.execute("getRoles")
Configuration
The client validates configuration at construction time and raises ConfigurationError for invalid settings.
Supported authentication modes:
sessionapi_key
Default values:
auth_mode="session"api_key_header="Api-Key"timeout=30.0max_retries=3retry_wait_seconds=0.5output_format="json"
Exceptions
The SDK raises a shared base exception type, bcic.exceptions.BCICError, with more specific subclasses such as:
ConfigurationErrorAuthenticationErrorAuthorizationErrorValidationErrorAPIErrorRateLimitErrorNotFoundErrorServerErrorNetworkError
Development
poetry install
poetry run pytest
poetry run ruff check .
poetry run mypy bcic
Packaging
Build artifacts:
poetry build
Validate the distribution before publishing:
twine check dist/*
Publishing
Recommended release flow:
- Bump the version in
pyproject.toml. - Run the test suite.
- Build the package.
- Upload to TestPyPI first.
- Verify installation from TestPyPI.
- Upload to PyPI.
License
MIT
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 Distribution
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 bcic_client_api-0.1.0.tar.gz.
File metadata
- Download URL: bcic_client_api-0.1.0.tar.gz
- Upload date:
- Size: 21.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
647c01fdc4ebe571ad3b35f2a995fa5c2db157b28f5292f24c537b6bec4c86c9
|
|
| MD5 |
c85db536d5930ae80c2194960ba70038
|
|
| BLAKE2b-256 |
97e8e94d2067d543fb941ef94d701f909dc7fca7dec8eb7640b23d03ecd2685f
|
File details
Details for the file bcic_client_api-0.1.0-py3-none-any.whl.
File metadata
- Download URL: bcic_client_api-0.1.0-py3-none-any.whl
- Upload date:
- Size: 29.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63e73038ceb70b941106a606e5ff488ffb7c8d481e22e1efb13a3af0a545d9ba
|
|
| MD5 |
15a6fe15207a83d4d44cc2ebd2c65cdb
|
|
| BLAKE2b-256 |
0f5a36290539426b9ec08689463b2b89b40e0d91df8710c9c28e832063f4bb03
|