The official Python client for TradeVPS APIs.
pip install tradevpsfrom tradevps import Client
from tradevps.exceptions import AuthenticationError, APIError
# Initialize client
client = Client()
# Method 1: Login with email/password
try:
auth = client.login("your-email@example.com", "your-password")
print(f"Logged in as: {auth.user.name}")
# Token is automatically set after login
# You can also set it manually:
client.set_api_key(auth.token)
except AuthenticationError as e:
print(f"Authentication failed: {e}")
# Method 2: Initialize with API key directly
client = Client(api_key="your-api-key")
# Handle API errors
try:
# Your API calls here
pass
except APIError as e:
print(f"API error: {e.message} (Status: {e.status_code})")- Clone the repository
- Install dependencies:
pdm install - Run tests:
pdm run pytest
MIT License