Python SDK
The arianet package is the official Python client for the Arianet APIs. It has no
dependencies outside the standard library and needs Python 3.10 or newer.
- Source: github.com/ariaservice/arianet-python (current version 0.1.0)
Install
pip install arianet
Until the package is on PyPI, install it straight from GitHub:
pip install "git+https://github.com/ariaservice/arianet-python@v0.1.0"
Quickstart
Create a personal API token in the panel and export it:
export ARIANET_TOKEN="paste-your-token-here"
import arianet
client = arianet.Client() # reads ARIANET_TOKEN
page = client.cloud.list_servers(per_page=50)
for server in page["data"]:
print(server["id"], server["name"], server["status"])
API groups
| Attribute | API |
|---|---|
client.core | Account, tokens, VPS, SSH keys, firewalls, balance and invoices |
client.cloud | Arianet Cloud |
client.regional_vps | Regional VPS |
client.hosting | Hosting |
client.baremetal | Dedicated servers |
client.sms | SMS |
Method names are the snake_case operationId (listServers becomes list_servers). Path
parameters come first, the JSON body is the body argument (a dict or list), and query
parameters are keyword arguments (one named like a Python keyword, such as from, gets a trailing
underscore: from_). Every method returns the decoded JSON response.
server = client.cloud.create_server({
"name": "web-1",
"plan_id": 101,
"image": "ubuntu-24.04",
"datacenter": "ovh",
})
Configuration
client = arianet.Client(
"token", # default: ARIANET_TOKEN
base_url="https://api.ariaservice.net", # default, or ARIANET_API_URL
timeout=60.0,
max_retries=3,
max_retry_wait=60.0,
)
max_retries is the number of retries and max_retry_wait the longest wait (seconds) before one
retry. When Retry-After is longer, arianet.RateLimitError is raised at once with
retry_after set. To keep a retried order safe across process restarts too, pass your own
idempotency_key="...".
Errors
from arianet import ErrorCode
try:
client.core.create_server(order)
except arianet.APIError as err:
if err.code == ErrorCode.INSUFFICIENT_BALANCE:
... # top up the wallet
else:
print(err.status_code, err.code, err.message)
except arianet.APIConnectionError:
... # no answer: DNS, TLS, timeout
Each HTTP status has its own exception: AuthenticationError (401), PaymentRequiredError
(402), PermissionDeniedError (403), NotFoundError (404), ConflictError (409),
UnprocessableEntityError (422), RateLimitError (429) and InternalServerError (5xx); all
subclass APIError. err.reason refines the code on some errors (for example identity_hold).
Regions and new endpoints
iran = client.regional_vps.with_region("iran-1")
servers = iran.list_servers()
# Any path, with the same auth, retries and errors:
client.request("GET", "/cloud/v1/new-endpoint", query={"page": 2})