{"id":3961,"library":"diracx-api","title":"DiracX Python API Client","description":"The DiracX Python API Client provides an interface for interacting with the DiracX API. It simplifies making requests, handling authentication, and processing responses for various DiracX services. The current version is 0.0.12, and as a rapidly evolving library targeting Python 3.11+, it experiences frequent updates.","status":"active","version":"0.0.12","language":"en","source_language":"en","source_url":"https://github.com/DiracX-Labs/diracx-api-python","tags":["api-client","web-api","rest","blockchain","financial-data"],"install":[{"cmd":"pip install diracx-api","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Handles underlying HTTP requests to the DiracX API.","package":"requests"}],"imports":[{"symbol":"DiracXClient","correct":"from diracx_api import DiracXClient"}],"quickstart":{"code":"import os\nfrom diracx_api import DiracXClient\n\n# Ensure DIRACX_API_KEY and DIRACX_BASE_URL are set in your environment\napi_key = os.environ.get(\"DIRACX_API_KEY\", \"\")\nbase_url = os.environ.get(\"DIRACX_BASE_URL\", \"https://api.diracx.com\")\n\nif not api_key:\n    print(\"Warning: DIRACX_API_KEY environment variable not set. API calls may fail.\")\n\ntry:\n    client = DiracXClient(api_key=api_key, base_url=base_url)\n\n    # Example: List assets\n    assets_response = client.assets.list_assets()\n\n    if assets_response.success:\n        print(\"Assets retrieved successfully:\")\n        for asset in assets_response.data:\n            print(f\"  ID: {asset.asset_id}, Symbol: {asset.symbol}\")\n    else:\n        print(f\"Failed to retrieve assets: {assets_response.error_message}\")\nexcept Exception as e:\n    print(f\"An error occurred during API interaction: {e}\")\n","lang":"python","description":"Initializes the DiracXClient using environment variables for credentials and lists available assets."},"warnings":[{"fix":"Regularly check the GitHub repository's release notes for `diracx-api` before updating. Pin the exact version (`diracx-api==0.0.12`) in production environments to prevent unexpected breakages.","message":"As the library is in early development (version 0.0.x), breaking changes can be introduced in any patch release without a major version increment, affecting method signatures, return types, or data structures.","severity":"breaking","affected_versions":"0.0.x"},{"fix":"Ensure `DIRACX_API_KEY` is correctly set in your environment. Optionally, set `DIRACX_BASE_URL` if you need to target a different endpoint; otherwise, it defaults to `https://api.diracx.com`.","message":"API key (`DIRACX_API_KEY`) and base URL (`DIRACX_BASE_URL`) are typically provided via environment variables. Failing to set `DIRACX_API_KEY` will result in authentication errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always check `response.success` before accessing `response.data`. Handle `response.error_message` for failed requests to understand the cause of the failure.","message":"All API responses are wrapped in a standard `success`/`error_message`/`data` structure. Direct access to `response.data` without checking `response.success` can lead to errors if the API call failed.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}