Skip to main content

Async HTTP client for Atlas Command.

Project description

Atlas Command HTTP Client (Python)

atlas-asset-client is a lightweight async wrapper around the Atlas Command REST API. It replaces the retired WebSocket helpers and provides strongly-typed convenience methods for working with entities, tasks, objects, and query endpoints via HTTP.

Installation

pip install atlas-asset-client

During local development inside this repository:

pip install -e Atlas_Command/connection_packages/atlas_asset_ws_client

Quickstart

import asyncio
from atlas_asset_ws_client import AtlasCommandHttpClient

async def main() -> None:
    async with AtlasCommandHttpClient("http://localhost:8000") as client:
        entity = await client.create_entity(
            entity_id="asset-1",
            entity_type="asset",
            alias="Demo Asset",
            components={"telemetry": {"latitude": 40.7, "longitude": -74.0}},
        )
        print("Created entity:", entity["entity_id"])

        tasks = await client.list_tasks(limit=10)
        print("Existing tasks:", [t["task_id"] for t in tasks])

        snapshot = await client.get_full_dataset()
        print("Snapshot counts:", {k: len(v) for k, v in snapshot.items()})

asyncio.run(main())

Features

  • Uses httpx.AsyncClient under the hood with pluggable transport/timeouts.
  • Convenience methods for every public endpoint:
    • list_entities, get_entity, create_entity, update_entity, delete_entity, get_entity_by_alias, update_entity_telemetry
    • list_tasks, create_task, get_task, update_task, delete_task, get_tasks_by_entity, start_task, complete_task, fail_task
    • list_objects, create_object, get_object, update_object, delete_object, get_objects_by_entity, get_objects_by_task, find_orphaned_objects, add_object_reference, remove_object_reference, get_object_references, validate_object_references, cleanup_object_references
    • get_changed_since, get_full_dataset
  • Optional bearer token support via the token= constructor parameter.
  • Context manager support (async with client:) to manage connection lifecycle.

Configuration

client = AtlasCommandHttpClient(
    "https://atlas.example.com",
    token="my-api-token",
    timeout=30.0,
)

You can also pass a custom httpx transport for testing:

transport = httpx.MockTransport(my_handler)
client = AtlasCommandHttpClient("http://testserver", transport=transport)

Testing

Run the suite with:

pip install -e .[dev]
pytest

The tests use httpx.MockTransport so they do not require a running Atlas Command instance.

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

atlas_asset_client-0.2.1.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

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

atlas_asset_client-0.2.1-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file atlas_asset_client-0.2.1.tar.gz.

File metadata

  • Download URL: atlas_asset_client-0.2.1.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for atlas_asset_client-0.2.1.tar.gz
Algorithm Hash digest
SHA256 fbebfbb7e06e9760c1085a3ab8ec40890ca14a0c4b22801e3037cc8ff4953b47
MD5 5f8866742f507405c5e522128b3b3a41
BLAKE2b-256 96f6fd9f20f2eb08f012d3ce90b1ab854dd34100cc1600b6cc32933e8266264f

See more details on using hashes here.

File details

Details for the file atlas_asset_client-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for atlas_asset_client-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4b257aa344c4781419e84b176ec25529c32a514cf4930705bbc7f402d7fc861e
MD5 3c419649ec02bf348bdefe856d2a5470
BLAKE2b-256 3bb1e95874bb0bb0297ccec72bf578f04615c0e268b8cf9721dab075a3b01ad7

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