HTTP client for interacting with FLAME Hub services.
Project description
FLAME Hub Client
The FLAME Hub Client is a Python Client which wraps the endpoints of FLAME Hub API. This repository is part of the PrivateAIM project.
Getting started
To install the client, Python 3.10 or higher is required.
python -m pip install flame-hub-client
Quickstart
The FLAME Hub Client offers get, find, update, create and delete methods for the core, storage and auth endpoints. It is capable of authenticating against the API using either password or robot authentication. Pick one, provide your credentials and plug them into the class for the service you want to use. Note that the client will automatically reauthenticate if necessary.
import flame_hub
auth = flame_hub.auth.PasswordAuth(
username="admin", password="start123", base_url="http://localhost:3000/auth/"
)
auth_client = flame_hub.AuthClient(base_url="http://localhost:3000/auth/", auth=auth)
Now you're ready to use the library's functions! Start off with getting the so-called master realm by using one of the
find methods and filtering for the name "master".
master_realms = auth_client.find_realms(filter={"name": "master"})
Every find method returns a list of matching resources. Since there is only one realm called "master" in this
example, we simply pop it from the list and print the result.
assert len(master_realms) == 1
master_realm = master_realms.pop()
print(master_realm.model_dump_json(indent=2))
{
"name": "master",
"display_name": null,
"description": null,
"id": "794f2375-f043-4789-bd0c-e5534e8deeaa",
"built_in": true,
"created_at": "2025-05-12T09:44:08.284000Z",
"updated_at": "2025-05-12T09:44:08.284000Z"
}
Next we want to create a new node. Node resources are accessible over endpoints under the core directive. So the first step is to create a new core client and then create a new node.
core_client = flame_hub.CoreClient(base_url="http://localhost:3000/core/", auth=auth)
my_node = core_client.create_node(name="my-node", realm_id=master_realm)
print(my_node.model_dump_json(indent=2))
{
"external_name": null,
"hidden": false,
"name": "my-node",
"realm_id": "794f2375-f043-4789-bd0c-e5534e8deeaa",
"registry_id": null,
"type": "default",
"id": "03636152-e6a8-4e01-994e-18b2b0c3a935",
"public_key": null,
"online": false,
"registry": null,
"registry_project_id": null,
"registry_project": null,
"robot_id": "200aab68-a686-407c-a6c1-2dd367ff6031",
"created_at": "2025-05-19T15:43:57.859000Z",
"updated_at": "2025-05-19T15:43:57.859000Z"
}
Maybe making the node public wasn't such a good idea, so let's update it by hiding it. To see if the update was successful, we have to request the updated node from the Hub.
core_client.update_node(my_node, hidden=True)
assert core_client.get_node(my_node.id) is True
To clean up our mess, we delete the node and verify that the node is gone forever.
core_client.delete_node(my_node)
assert core_client.get_node(my_node.id) is None
Note that not all method types are implemented for each resource. Check out the documentation which methods are available.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flame_hub_client-0.2.6.tar.gz.
File metadata
- Download URL: flame_hub_client-0.2.6.tar.gz
- Upload date:
- Size: 24.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e484b899022a7673b5be12eb42ad2db6f3c866f40ed5ef2abd57111f6d2e5bb
|
|
| MD5 |
3e8007c2f340ccd7b6990dc9787798de
|
|
| BLAKE2b-256 |
e6a86b1491a72083450b0ab06bec4490b03020bce1480ba77f236e75b7b39f02
|
Provenance
The following attestation bundles were made for flame_hub_client-0.2.6.tar.gz:
Publisher:
publish.yml on PrivateAIM/hub-python-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flame_hub_client-0.2.6.tar.gz -
Subject digest:
9e484b899022a7673b5be12eb42ad2db6f3c866f40ed5ef2abd57111f6d2e5bb - Sigstore transparency entry: 351672502
- Sigstore integration time:
-
Permalink:
PrivateAIM/hub-python-client@772f7a49a83bc597cce07fb7190a7429fa6b2585 -
Branch / Tag:
refs/tags/v0.2.6 - Owner: https://github.com/PrivateAIM
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@772f7a49a83bc597cce07fb7190a7429fa6b2585 -
Trigger Event:
push
-
Statement type:
File details
Details for the file flame_hub_client-0.2.6-py3-none-any.whl.
File metadata
- Download URL: flame_hub_client-0.2.6-py3-none-any.whl
- Upload date:
- Size: 27.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45e829223c6c4be012348134220c066e6aefb6a8e696d52cb3c64d4247f33e63
|
|
| MD5 |
bb1da000f6df3deaae3efb082c075e0c
|
|
| BLAKE2b-256 |
791f323ed0404d8f8563be816d7f292c65a7fca6ad3ca4eb8565db4bad5c3c63
|
Provenance
The following attestation bundles were made for flame_hub_client-0.2.6-py3-none-any.whl:
Publisher:
publish.yml on PrivateAIM/hub-python-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flame_hub_client-0.2.6-py3-none-any.whl -
Subject digest:
45e829223c6c4be012348134220c066e6aefb6a8e696d52cb3c64d4247f33e63 - Sigstore transparency entry: 351672521
- Sigstore integration time:
-
Permalink:
PrivateAIM/hub-python-client@772f7a49a83bc597cce07fb7190a7429fa6b2585 -
Branch / Tag:
refs/tags/v0.2.6 - Owner: https://github.com/PrivateAIM
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@772f7a49a83bc597cce07fb7190a7429fa6b2585 -
Trigger Event:
push
-
Statement type: