zicon-cloud
Python SDK for the ZiCON Cloud API.
Installation
pip install zicon-cloud
Quickstart
from zicon_cloud import ZiconClient
# Public endpoints work without an API key
client = ZiconClient()
# Authenticated endpoints require an api_key
client = ZiconClient(api_key="YOUR_ZICON_API_KEY")
Usage
List datasets (no auth required)
from zicon_cloud import ZiconClient
client = ZiconClient()
datasets = client.list_datasets()
print(datasets)
Get a single dataset (no auth required)
dataset = client.get_dataset("dataset-id")
print(dataset)
Get dataset contents (no auth required)
contents = client.get_dataset_contents("dataset-id")
print(contents)
List projects (requires API key)
from zicon_cloud import ZiconClient
client = ZiconClient(api_key="YOUR_ZICON_API_KEY")
projects = client.list_projects()
print(projects)
Get files for a project (requires API key)
files = client.get_project_files("project-id")
print(files)
Get a file download URL (requires API key)
download_url = client.get_download_url("file-id")
print(download_url)
List endpoints (no auth required)
endpoints = client.list_endpoints()
print(endpoints)
List tools (no auth required)
tools = client.list_tools()
print(tools)
Download a dataset (no auth required)
download = client.download_dataset("dataset-id")
print(download)
Delete a project (requires API key)
client = ZiconClient(api_key="YOUR_ZICON_API_KEY")
client.delete_project("project-id")
Create a project (requires an access token)
create_project authenticates differently from the other methods above: it
takes an access_token argument and sends it as an Authorization: Bearer
header, instead of using the client's api_key.
from zicon_cloud import ZiconClient
client = ZiconClient()
project = client.create_project(
name="My Project",
category="research",
description="A project created via the SDK",
access_token="YOUR_ACCESS_TOKEN",
)
print(project)
Error handling
The SDK raises typed exceptions based on the API response:
from zicon_cloud import (
ZiconClient,
ZiconAuthError,
ZiconPermissionError,
ZiconNotFoundError,
ZiconServerError,
)
client = ZiconClient(api_key="YOUR_ZICON_API_KEY")
try:
projects = client.list_projects()
except ZiconAuthError:
print("Invalid or missing API key")
except ZiconPermissionError:
print("Your API key doesn't have permission for this")
except ZiconNotFoundError:
print("Resource not found")
except ZiconServerError:
print("ZiCON Cloud is having server issues, try again later")
Calling an authenticated method (list_projects, get_project_files,
get_download_url, delete_project) without an api_key set on the client
raises ZiconAuthError immediately, without making a network request.
Likewise, calling create_project without an access_token raises
ZiconAuthError immediately.
Development
pip install -e ".[test]"
pytest
Metadata
Release files for zicon-cloud 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| zicon_cloud-0.3.0.tar.gz | 5.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| zicon_cloud-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.6 kB
Release files / zicon_cloud-0.3.0.tar.gz
| Download URL | zicon_cloud-0.3.0.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
046571a8481ecedba4c5c46b4ba50636e3c8559ad0343b555675e7b563b3578f
|
|
BLAKE2b-256 checksum How to use checksums |
67fc1e9fa087b3f4e3225a6cb74f908e8df968dd3491302253d2fec813adf93c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / zicon_cloud-0.3.0-py3-none-any.whl
| Download URL | zicon_cloud-0.3.0-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2f2cf076151c4a3f0df31a44cf5b836741b8feed265ed419c20e40dcc702bc9d
|
|
BLAKE2b-256 checksum How to use checksums |
bff11d63234f829cfb673600ae064e5977c0a2d880d7fc74a85e3674b86a6fcf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|