Skip to main content

Python SDK for interacting with the Albatross API

Project description

Albatross Python SDK

Pyright Type Checking

A Python SDK for interacting with the Albatross API. This SDK provides a simple and intuitive way to manage categories and units in your Albatross instance.

Features

  • Easy authentication using ECDSA keypairs
  • Category management (create, update, list)
  • Unit operations
  • CSV data import support

Installation

pip install albatross-sdk  # Replace with actual package name once published

Prerequisites

  • Python 3.12 or higher
  • An Albatross instance and credentials
  • ECDSA keypair for authentication

Authentication

Generating a Keypair

Generate an ECDSA keypair using OpenSSL:

openssl ecparam -genkey -name prime256v1 -noout -out ecdsa_private_key.pem
openssl ec -in ecdsa_private_key.pem -pubout -out ecdsa_public_key.pem

Quick Start

from albatross_sdk.lib import AlbatrossSDK, CategoryData

# Initialize the client
private_key = AlbatrossSDK.load_private_key("path/to/your/private_key.pem")
instance_id = "your-instance-id"
client = AlbatrossSDK(
    instance=instance_id,
    private_key=private_key,
    base_url="https://your-albatross-instance.com"  # Optional
)

# Check API version
version = client.get_api_version()
print(f"Connected to Albatross API version: {version}")

# Create a category
category_data: CategoryData = {
    "unit": "user",
    "values": {
        "country_code": "US",
        "grade_level": 3,
        "user": "user-uuid"
    }
}

response = client.put_categories([category_data])
print(f"Category created: {response}")

Working with Categories

Single Category Operations

# Define a category
user_category: CategoryData = {
    "unit": "user",
    "values": {
        "country_code": "AT",
        "grade_level": 2,
        "user": "39e23058-b7da-4a79-b464-5b67b579a433"
    }
}

# Create or update the category
result = client.put_categories([user_category])

Bulk Import from CSV

# Import categories from a CSV file
client.put_categories_csv("path/to/categories.csv", "user")

Configuration Examples

# Multiple instance configuration
instances = {
    "prod": "c094dea1-8b01-11ef-9882-068cf85ff8bb",
    "staging": "22a06113-8b04-11ef-ade1-42010aac0020",
    "dev": "96757573-827b-11ef-9882-068cf85ff8bb",
}

# Initialize client with specific instance
client = AlbatrossSDK(
    instance=instances["prod"],
    private_key=private_key,
    base_url="https://api.albatross.com"
)

Development

Running Tests

python -m pytest

Type Checking

pyright .

Related Resources

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

albatross_sdk-0.1.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

albatross_sdk-0.1.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file albatross_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: albatross_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for albatross_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 25663ab3b2419c48fc6758dc05ea6c10005faab2735fbfe3cdb877c27b8f984d
MD5 5994697755646f1ff7be0f70249d653c
BLAKE2b-256 9c3139fc0402b1132b4a019271bcc4bd715a2d966ee1f8f54e4cd38851d1139b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: albatross_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for albatross_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d500187bc2059038d0639b20a8986dd1f78b142f30e5953d8288e2681ab62131
MD5 87b0b8444e61a9b36c536e39b3cebc73
BLAKE2b-256 40eecd8c80d330155e4e11135159597493492c54eff83f4d011b279ace9881f0

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