Odyn is a python client for Business Central Web Services API.
Project description
Odyn
Odyn is a modern, async-first Python client for Microsoft Dynamics 365 Business Central Web Services. It provides a high-level interface for extracting and interacting with data from Business Central using OData, handling the complexities of authentication, rate limiting, and data transformation.
Project Scope
This project was designed for personal use and follows an opinionated structure. It currently supports Business Central OData Web Services specifically. It is not intended for use with the standard Business Central API v2.0 endpoints.
Problem Solved
Integrating with Business Central Web Services often involves significant boilerplate for authentication, manual construction of OData queries, complex pagination logic, and data conversion. Odyn eliminates this overhead by providing a type-safe, fluent API that returns native Polars DataFrames, designed specifically for data engineering and high-performance integration tasks.
Capabilities
- Async Execution: Built on httpx for high-performance asynchronous I/O.
- Polars Integration: Native support for Polars DataFrames for efficient data processing.
- Query Builder: Type-safe OData query builder with support for filters, expansions, and ordering.
- Caching: Persistent Parquet-based caching with configurable TTL to reduce API load.
- Resilience: Automatic retries with exponential backoff and configurable rate limiting (via aiolimiter).
- Data Handling: Automatic pagination, streaming, and efficient batching for large datasets.
Dependencies
- Python 3.12+
- httpx
- polars
- aiolimiter
Installation
pip install odyn
Quick Example
import asyncio
from odyn import BCWebServiceClient, BasicAuth
from odyn.query import ODataQuery, F
async def main():
async with BCWebServiceClient.create(
server="https://bc-server:7048",
instance="BC200",
auth=BasicAuth("user", "password"),
company="CRONUS",
) as client:
# Fetch customers with balance > 1000
query = ODataQuery().filter(F.Balance > 1000)
df = await client.get("customers", query=query)
print(df)
if __name__ == "__main__":
asyncio.run(main())
Documentation
Comprehensive documentation is available in the docs/ directory:
- API Reference — Detailed class and method reference.
- Client Configuration — Setting up the
BCWebServiceClient. - Authentication — Configuring authentication for your environment.
- Query Builder — Building type-safe filters and expansions.
- Caching — Improving performance with local Parquet caching.
- Exception Handling — Understanding the error hierarchy.
- Troubleshooting — Solutions for common BC integration issues.
Examples
Refer to the examples/ directory for functional examples covering various use cases:
- Quickstart: Basic setup and simple GET request.
- Query Builder: Filtering, selection, ordering, and expands.
- Lookups: Fetching single records by key or ID.
- Batch Operations: Concurrent lookups for multiple IDs.
- Streaming: Processing large datasets page-by-page.
- Caching: Persistent Parquet-based caching.
- Error Handling: Common exceptions and error patterns.
- Configuration: Advanced client settings (retries, rate limits).
- Sync Compatibility: Using Odyn in non-async applications.
- Metadata: Inspecting available endpoints and counts.
License
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
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 odyn-0.4.2.tar.gz.
File metadata
- Download URL: odyn-0.4.2.tar.gz
- Upload date:
- Size: 30.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d3795f91332fa804b994225794ae6706a55029d688cc219cac73afb06a4a855
|
|
| MD5 |
fa9867b3a4cd2bd022472e91bda7143f
|
|
| BLAKE2b-256 |
4846698d8cb179e97860cf7e98f2ddd0759b9f5c707bc2d112c8d27a96e579e4
|
File details
Details for the file odyn-0.4.2-py3-none-any.whl.
File metadata
- Download URL: odyn-0.4.2-py3-none-any.whl
- Upload date:
- Size: 34.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e46a6b90828909cfcd3416bae3b2a33cea07a479831058ebc019187ffbc3063
|
|
| MD5 |
a4c257dc6739aafe1fc93c37adc0ee26
|
|
| BLAKE2b-256 |
ee474ade9f902fb4fe663756d0de12d1121cad97f8fae692ef1a0bb6d0505fb7
|