Python SDK for the ZiCON Cloud API
Project description
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
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 zicon_cloud-0.3.0.tar.gz.
File metadata
- Download URL: zicon_cloud-0.3.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
046571a8481ecedba4c5c46b4ba50636e3c8559ad0343b555675e7b563b3578f
|
|
| MD5 |
40603694a69a8d01f87984e80af9e964
|
|
| BLAKE2b-256 |
67fc1e9fa087b3f4e3225a6cb74f908e8df968dd3491302253d2fec813adf93c
|
File details
Details for the file zicon_cloud-0.3.0-py3-none-any.whl.
File metadata
- Download URL: zicon_cloud-0.3.0-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f2cf076151c4a3f0df31a44cf5b836741b8feed265ed419c20e40dcc702bc9d
|
|
| MD5 |
f2f3a66ebfa0ead8efd4ee2f8b5905af
|
|
| BLAKE2b-256 |
bff11d63234f829cfb673600ae064e5977c0a2d880d7fc74a85e3674b86a6fcf
|