import os
import requests

base = os.getenv("CQI_API_BASE", "https://api-test.crewqi.com")
organization_id = os.environ["CQI_ORGANIZATION_ID"]
api_key = os.environ["CQI_API_KEY"]
response = requests.get(
    f"{base}/v1/organizations/{organization_id}/locations",
    headers={"Authorization": f"Bearer {api_key}", "Accept": "application/json"},
    params={"limit": 50},
    timeout=30,
)
response.raise_for_status()
page = response.json()
print(page["items"])
print(page.get("nextCursor"))
