Skip to main content
ℹ️SDK under development

The official Python SDK is not yet available. In the meantime, you can call the API directly using the requests library.

Direct API usage with requests

Install the dependency:

pip install requests

Basic example

import requests

BASE_URL = "https://kwery-api.com"
API_KEY = "YOUR_KEY"

response = requests.get(f"{BASE_URL}/v1/binance/spot/BTCUSDT/ticker", params={"api-key": API_KEY})
response.raise_for_status()

data = response.json()
print(data)

Fetching multiple endpoints

import requests

BASE_URL = "https://kwery-api.com"
API_KEY = "YOUR_KEY"

def get(path: str) -> dict:
    r = requests.get(f"{BASE_URL}{path}", params={"api-key": API_KEY})
    r.raise_for_status()
    return r.json()

spot = get("/v1/binance/spot/ETHUSDT/ticker")
futures = get("/v1/binance/futures/ETHUSDT/ticker")
oracle = get("/v1/chainlink/ETH-USD")

print(f"Spot: {spot}")
print(f"Futures: {futures}")
print(f"Oracle: {oracle}")

Error handling

import requests

try:
    r = requests.get(
        "https://kwery-api.com/v1/binance/spot/INVALID/ticker",
        params={"api-key": "YOUR_KEY"},
    )
    r.raise_for_status()
except requests.exceptions.HTTPError as e:
    print(f"HTTP {e.response.status_code}: {e.response.json()}")

See also