Skip to main content

Turbine GraphQL Python SDK (generated via ariadne-codegen)

Project description

Turbine Python SDK

Minimal, sync-first Python client for the Turbine GraphQL API.

Getting Started

Installation from PyPI

Install from PyPI as netrise-turbine-sdk:

# pip
pip install netrise-turbine-sdk

# poetry
poetry add netrise-turbine-sdk

# uv
uv add netrise-turbine-sdk

Configure environment variables

The SDK automatically loads environment variables from a .env file in your current working directory when you call TurbineClientConfig.from_env(). You can also set environment variables directly.

Option 1: Using a .env file (recommended)

Create a .env file in your project directory:

endpoint=https://apollo.turbine.netrise.io/graphql/v3
audience=https://prod.turbine.netrise.io/
domain=https://authn.turbine.netrise.io
client_id=<client_id>
client_secret=<client_secret>
organization_id=<org_id>

The SDK will automatically load these when you call TurbineClientConfig.from_env(). The .env file is searched in:

  • Current working directory (most common)
  • Parent directories (walks up the directory tree)

Option 2: Set environment variables directly

import os
os.environ["endpoint"] = "https://apollo.turbine.netrise.io/graphql/v3"
# ... set other variables

cfg = TurbineClientConfig.from_env(load_env_file=False)

Option 3: Disable automatic .env loading

If you prefer to load .env files manually:

from dotenv import load_dotenv
load_dotenv()  # Your custom loading logic

cfg = TurbineClientConfig.from_env(load_env_file=False)

Populate the missing values. Reach out to mailto:support@netrise.io if you need assistance.

Union Field Aliasing Convention

When GraphQL union types have members with identically-named fields that return different types, the SDK automatically applies aliases to disambiguate them. This is necessary because code generators cannot create a single Python type for fields with conflicting return types.

Naming Convention

Aliased fields follow the pattern: {camelCaseTypeName}{PascalCaseFieldName}

For example, the NotificationControl union has AssetAnalysisControl and UserManagementControl types that both define an events field with different return types. In the generated SDK, these become:

  • AssetAnalysisControl.eventsassetAnalysisControlEvents
  • UserManagementControl.eventsuserManagementControlEvents

Example Usage

# Accessing aliased fields on union type members
notification_settings = client.query_notification_settings()

for pref in notification_settings.preferences:
    for control in pref.controls:
        # Access the aliased field based on the control type
        if hasattr(control, 'assetAnalysisControlEvents'):
            events = control.assetAnalysisControlEvents
        elif hasattr(control, 'userManagementControlEvents'):
            events = control.userManagementControlEvents

This aliasing is applied automatically during SDK generation and only affects fields that would otherwise cause type conflicts.

License

See LICENSE for details.

Documentation

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

netrise_turbine_sdk-0.1.10.tar.gz (81.0 kB view details)

Uploaded Source

Built Distribution

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

netrise_turbine_sdk-0.1.10-py3-none-any.whl (128.9 kB view details)

Uploaded Python 3

File details

Details for the file netrise_turbine_sdk-0.1.10.tar.gz.

File metadata

  • Download URL: netrise_turbine_sdk-0.1.10.tar.gz
  • Upload date:
  • Size: 81.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for netrise_turbine_sdk-0.1.10.tar.gz
Algorithm Hash digest
SHA256 7f77f90a7c8e62f053d876da185cb73783dd3a8e839c815929746ba3c545d109
MD5 521fd4c9768f7e11d5ccc68291881174
BLAKE2b-256 bfcfa666a89f060cf6168136d426451612729dd887828c6a00d5fe43a60b5116

See more details on using hashes here.

File details

Details for the file netrise_turbine_sdk-0.1.10-py3-none-any.whl.

File metadata

File hashes

Hashes for netrise_turbine_sdk-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 4f0cacbd48f4dc2588107dcf70d16584c062186c384237ff692a05a793d4eae4
MD5 86603527dd58d98f124be044166ad230
BLAKE2b-256 5b81ca2e35ffe4fa9c8350dd38bdc1bda1fc5ccc42c931ee39e806e6bea432d8

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