Skip to main content

Alloy Python SDK Generated by Speakeasy

Project description

Alloy Python SDK (AI generated)

This is a library to interact with Alloy's APIs. This library supports Alloy Embedded.

Documentation

Visit the Alloy Docs site for more information on how to get started with Alloy APIs.

SDK Installation

You can install the SDK by cloning this repo or running

pip3 install git+https://github.com/onedebos/alloy-python-sdk-ai.git [--break-system-packages]

SDK Example Usage

Example

import alloypythonsdk
from alloypythonsdk.models import operations

s = alloypythonsdk.AlloyPythonSDK(
    api_key="bearer <YOUR_API_KEY_HERE>",
)


res = s.update_a_user(user_id='<value>', request_body=operations.UpdateAUserRequestBody())

if res.object is not None:
    # handle response
    pass

Available Resources and Operations

AlloyPythonSDK

Error Handling

Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an error. If Error objects are specified in your OpenAPI Spec, the SDK will raise the appropriate Error type.

Error Object Status Code Content Type
errors.UpdateAUserResponseBody 401 application/json
errors.SDKError 4xx-5xx /

Example

import alloypythonsdk
from alloypythonsdk.models import errors, operations

s = alloypythonsdk.AlloyPythonSDK(
    api_key="bearer <YOUR_API_KEY_HERE>",
)

res = None
try:
    res = s.update_a_user(user_id='<value>', request_body=operations.UpdateAUserRequestBody())

except errors.UpdateAUserResponseBody as e:
    # handle exception
    raise(e)
except errors.SDKError as e:
    # handle exception
    raise(e)

if res.object is not None:
    # handle response
    pass

Server Selection

Select Server by Index

You can override the default server globally by passing a server index to the server_idx: int optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:

# Server Variables
0 https://embedded.runalloy.com/2024-03/ None

Example

import alloypythonsdk
from alloypythonsdk.models import operations

s = alloypythonsdk.AlloyPythonSDK(
    server_idx=0,
    api_key="bearer <YOUR_API_KEY_HERE>",
)


res = s.update_a_user(user_id='<value>', request_body=operations.UpdateAUserRequestBody())

if res.object is not None:
    # handle response
    pass

Override Server URL Per-Client

The default server can also be overridden globally by passing a URL to the server_url: str optional parameter when initializing the SDK client instance. For example:

import alloypythonsdk
from alloypythonsdk.models import operations

s = alloypythonsdk.AlloyPythonSDK(
    server_url="https://embedded.runalloy.com/2024-03/",
    api_key="bearer <YOUR_API_KEY_HERE>",
)


res = s.update_a_user(user_id='<value>', request_body=operations.UpdateAUserRequestBody())

if res.object is not None:
    # handle response
    pass

Custom HTTP Client

The Python SDK makes API calls using the requests HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with a custom requests.Session object.

For example, you could specify a header for every request that this sdk makes as follows:

import alloypythonsdk
import requests

http_client = requests.Session()
http_client.headers.update({'x-custom-header': 'someValue'})
s = alloypythonsdk.AlloyPythonSDK(client=http_client)

Authentication

Per-Client Security Schemes

This SDK supports the following security scheme globally:

Name Type Scheme
api_key apiKey API key

To authenticate with the API the api_key parameter must be set when initializing the SDK client instance. For example:

import alloypythonsdk
from alloypythonsdk.models import operations

s = alloypythonsdk.AlloyPythonSDK(
    api_key="bearer <YOUR_API_KEY_HERE>",
)


res = s.update_a_user(user_id='<value>', request_body=operations.UpdateAUserRequestBody())

if res.object is not None:
    # handle response
    pass

Development

This repository includes components generated by Speakeasy based on this OpenAPI spec, as well as human authored code that simplifies usage.

Maturity

This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.

Contributions

While we value open-source contributions to this SDK, this library is generated programmatically. Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release!

SDK Created by Speakeasy

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

alloy_python_sdk_ai-0.0.1.tar.gz (30.3 kB view details)

Uploaded Source

Built Distribution

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

alloy_python_sdk_ai-0.0.1-py3-none-any.whl (66.8 kB view details)

Uploaded Python 3

File details

Details for the file alloy_python_sdk_ai-0.0.1.tar.gz.

File metadata

  • Download URL: alloy_python_sdk_ai-0.0.1.tar.gz
  • Upload date:
  • Size: 30.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for alloy_python_sdk_ai-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e5a4b75173cde22b8f7f149afe3ecdb1cfdf0eacc2ac75270f6b3d35c75dd613
MD5 9e8eb378afa550debdfb6c5585e5790d
BLAKE2b-256 52bd0d4e5ea9a3564cf38e5cbe08899b116a62f8328a5002c374e256eca1a8b5

See more details on using hashes here.

File details

Details for the file alloy_python_sdk_ai-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for alloy_python_sdk_ai-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f5ce6b788f80cf5b698922f4bfd3bebca733175b57303f7b5964b9dd065179c0
MD5 e8e3dbaf6c3b5a6f115c2c4eecee11c9
BLAKE2b-256 566d44774912a798bc5ff3f05e62e71641b3c7d06da56d45b3d7c652b4a76ec2

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