Skip to main content

SDK Connection Error

Use this page when the Python SDK cannot reach the Custodian Labs API.

Symptoms

You may see:

  • APIConnectionError
  • Request failed after retries
  • Timeout errors
  • DNS or network errors
  • Connection refused errors

Likely Causes

Common causes include:

  • The machine has no internet access.
  • A firewall, proxy, or VPN is blocking requests.
  • CUSTODIAN_SDK_BASE_URL is incorrect.
  • The backend environment is temporarily unavailable.
  • The request timed out before the API responded.

How to Check

  1. Confirm your internet connection works.
  2. Confirm the SDK base URL is correct.
  3. Check whether a proxy or VPN is required.
  4. Try the same request from another network.
  5. Restart the Python process after changing environment variables.

You can print the environment variables used by your app:

import os

print(os.getenv("CUSTODIAN_SDK_BASE_URL"))
print(bool(os.getenv("CUSTODIAN_SDK_API_KEY")))

Do not print the full API key value.

How to Fix

  • Set CUSTODIAN_SDK_BASE_URL to the correct API base URL.
  • Set CUSTODIAN_SDK_API_KEY.
  • Restart your Python process.
  • Retry after confirming network access.
  • Contact support if the API appears unavailable from multiple networks.