Skip to main content

Viio Sync API SDK for Python

viio-sync-api-sdk contains the generated viio.sync.v1 protobuf contract and an AsyncIO client for authentication and explicit sync-batch lifecycle management.

Install

python -m pip install viio-sync-api-sdk

Python 3.11 and later are supported without an artificial upper minor-version cap. CI validates the minimum version and the latest stable Python release, so the upper tested version advances automatically.

Send a batch

from viio_sync_api import SyncApiAuthentication, SyncApiClient, SyncApiClientOptions
from viio_sync_api.v1 import Account, AccountRecords, GenericAccountDetails, SyncRecordsRequest


async def sync_accounts() -> None:
    options = SyncApiClientOptions(
        endpoint="https://sync.example.com",
        authentication=SyncApiAuthentication.api_key("your-api-key"),
    )

    async with SyncApiClient(options) as client:
        batch = await client.start_batch("installation-id")
        try:
            await batch.write(
                SyncRecordsRequest(
                    accounts=AccountRecords(
                        records=[
                            Account(
                                generic=GenericAccountDetails(
                                    id="account-1",
                                    email="person@example.com",
                                )
                            )
                        ]
                    )
                )
            )
            await batch.complete()
        except BaseException:
            await batch.abort()
            raise

Each write accepts exactly one typed records wrapper. A present empty wrapper represents an intentional empty snapshot:

await batch.write(SyncRecordsRequest(accounts=AccountRecords()))

SyncApiBatchAlreadyInProgressError distinguishes an existing sync. Protocol failures raise SyncApiProtocolError. Native grpc.aio.AioRpcError, cancellation, and timeout errors remain available for retry decisions.

The authenticated generated stub is available as client.grpc_client. Calls through it bypass batch validation.

max_receive_message_size caps individual responses received by this client, while max_send_message_size caps individual requests it sends. The receive limit defaults to 16 MiB to match the .NET SDK; setting either value to None leaves that direction at gRPC's default.

AWS Lambda

The Viio developer portal provides a complete Lambda handler and AWS SAM template. The handler acquires an application token from Microsoft Entra ID, pages through Microsoft Graph users, maps each user to MicrosoftEmployeeDetails, writes a complete employee snapshot, and completes or aborts the Sync API batch. The template configures Amazon EventBridge Scheduler to invoke it every night with cron(0 2 * * ? *).

Grant the Entra application the Microsoft Graph User.Read.All application permission and supply these Lambda environment variables from your secret-management system:

  • MICROSOFT_TENANT_ID
  • MICROSOFT_CLIENT_ID
  • MICROSOFT_CLIENT_SECRET
  • VIIO_SYNC_API_ENDPOINT
  • VIIO_SYNC_API_KEY
  • VIIO_DIRECT_INTEGRATION_INSTALLATION_ID

The example creates and closes the client inside each invocation's event loop. This avoids retaining a gRPC AsyncIO channel across event loops when Lambda reuses a warm execution environment.

grpcio contains native code. When creating a Lambda ZIP or layer on another operating system, ask pip for the matching Linux wheel:

# x86_64
python -m pip install \
  --platform manylinux2014_x86_64 \
  --implementation cp \
  --python-version 3.11 \
  --only-binary=:all: \
  --target package \
  viio-sync-api-sdk

# arm64
python -m pip install \
  --platform manylinux2014_aarch64 \
  --implementation cp \
  --python-version 3.11 \
  --only-binary=:all: \
  --target package \
  viio-sync-api-sdk

Replace 3.11 with the Python version of the target Lambda runtime. The same package can be installed normally in AWS Lambda Python container images. Full API documentation is available at https://developers.viio.io/sync-api.

Authentication and transport security

External integrations use API keys. Viio-managed callers can supply an asynchronous bearer-token provider.

Sync API endpoints must use HTTPS. HTTP is accepted only for loopback endpoints during development. SDK exception messages and representations do not include keys or bearer tokens.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

viio_sync_api_sdk-0.2.0.tar.gz (29.5 kB view details)

Uploaded Source

Built Distribution

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

viio_sync_api_sdk-0.2.0-py3-none-any.whl (42.0 kB view details)

Uploaded Python 3

File details

Details for the file viio_sync_api_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: viio_sync_api_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 29.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for viio_sync_api_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 373ab921963b94d6e80c69017e0b6c3835977c5e5ac5cf92ede2bb8ae22801a7
MD5 a667765bee50d34ab4dbcb32b8f5221d
BLAKE2b-256 769fe9b45f037ccee00e3703b3428d842199fed8101e8d6e253b68c6bf4e3a33

See more details on using hashes here.

Provenance

The following attestation bundles were made for viio_sync_api_sdk-0.2.0.tar.gz:

Publisher: sync-api-sdk.release.yml on viio-io/integration-domain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file viio_sync_api_sdk-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for viio_sync_api_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6ed821257c300133f8fbd85332616db73dd5b11d92745fa38e3ee56f8d1841b4
MD5 fb5c57f21caa957718da4723bcc55f2b
BLAKE2b-256 d958e876f1d2e4194611c423533d14652e0d9b9ca16f8adee5ff7d1eec32dec7

See more details on using hashes here.

Provenance

The following attestation bundles were made for viio_sync_api_sdk-0.2.0-py3-none-any.whl:

Publisher: sync-api-sdk.release.yml on viio-io/integration-domain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page