Skip to main content

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_URL
  • BCIC_USERNAME
  • BCIC_PASSWORD
  • BCIC_AUTH_MODE
  • BCIC_API_KEY
  • BCIC_API_KEY_HEADER
  • BCIC_TIMEOUT
  • BCIC_MAX_RETRIES
  • BCIC_RETRY_WAIT_SECONDS
  • BCIC_OUTPUT_FORMAT

Example:

from bcic import Client

client = Client.from_env()

Public API

Client

The client exposes these domain endpoints:

  • client.records
  • client.users
  • client.binary
  • client.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:

  • session
  • api_key

Default values:

  • auth_mode="session"
  • api_key_header="Api-Key"
  • timeout=30.0
  • max_retries=3
  • retry_wait_seconds=0.5
  • output_format="json"

Exceptions

The SDK raises a shared base exception type, bcic.exceptions.BCICError, with more specific subclasses such as:

  • ConfigurationError
  • AuthenticationError
  • AuthorizationError
  • ValidationError
  • APIError
  • RateLimitError
  • NotFoundError
  • ServerError
  • NetworkError

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:

  1. Bump the version in pyproject.toml.
  2. Run the test suite.
  3. Build the package.
  4. Upload to TestPyPI first.
  5. Verify installation from TestPyPI.
  6. Upload to PyPI.

License

MIT

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

bcic_client_api-0.1.0.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

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

bcic_client_api-0.1.0-py3-none-any.whl (29.9 kB view details)

Uploaded Python 3

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

Hashes for bcic_client_api-0.1.0.tar.gz
Algorithm Hash digest
SHA256 647c01fdc4ebe571ad3b35f2a995fa5c2db157b28f5292f24c537b6bec4c86c9
MD5 c85db536d5930ae80c2194960ba70038
BLAKE2b-256 97e8e94d2067d543fb941ef94d701f909dc7fca7dec8eb7640b23d03ecd2685f

See more details on using hashes here.

File details

Details for the file bcic_client_api-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for bcic_client_api-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 63e73038ceb70b941106a606e5ff488ffb7c8d481e22e1efb13a3af0a545d9ba
MD5 15a6fe15207a83d4d44cc2ebd2c65cdb
BLAKE2b-256 0f5a36290539426b9ec08689463b2b89b40e0d91df8710c9c28e832063f4bb03

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