{"id":27216,"library":"ory-hydra-client","title":"Ory Hydra Python Client SDK","description":"Python client for the Ory Hydra API, providing programmatic access to OAuth 2.0 and OpenID Connect functionality. Auto-generated from the official OpenAPI spec. Version 25.4.0 released 2025-04-27. Active development but versioning is tied to Hydra itself, not SDK maturity.","status":"active","version":"25.4.0","language":"python","source_language":"en","source_url":"https://github.com/ory/sdk","tags":["ory","hydra","oauth2","oidc","openid-connect","api-client"],"install":[{"cmd":"pip install ory-hydra-client","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"HTTP client used internally","package":"urllib3","optional":false},{"reason":"Date/time serialization","package":"python-dateutil","optional":false},{"reason":"SSL certificate validation","package":"certifi","optional":false}],"imports":[{"note":"hydra is a different package (Hydra/OmegaConf)","wrong":"import hydra","symbol":"OryHydraApiClient","correct":"from ory_hydra_client import OryHydraApiClient"},{"note":"Module path includes underscore after 'ory'","wrong":"from hydra_client import Configuration","symbol":"Configuration","correct":"from ory_hydra_client.configuration import Configuration"}],"quickstart":{"code":"from ory_hydra_client import OryHydraApiClient\nfrom ory_hydra_client.configuration import Configuration\n\nconfig = Configuration(host=os.environ.get('HYDRA_ADMIN_URL', 'http://localhost:4445'))\nconfig.api_key['bearer'] = os.environ.get('HYDRA_API_KEY', '')\napi_client = OryHydraApiClient(configuration=config)\napi_instance = api_client.admin_api\n# Example: list OAuth2 clients\ntry:\n    clients = api_instance.list_o_auth2_clients()\n    print(clients)\nexcept Exception as e:\n    print(f\"Error: {e}\")","lang":"python","description":"Initialize client with admin URL and optional API key. Replace localhost:4445 with your Hydra admin endpoint."},"warnings":[{"fix":"pip freeze | grep ory-hydra-client && add `ory-hydra-client==25.4.0` to requirements.txt","message":"Version 25.4.0 matches Hydra release version, not SDK stability. Breaking changes may occur between minor versions (e.g., 25.3.x -> 25.4.0). Pin exact version in production.","severity":"breaking","affected_versions":"all"},{"fix":"Use IDE autocomplete or browse https://github.com/ory/sdk/tree/master/clients/hydra/python","message":"Auto-generated SDK; method names are verbatim from OpenAPI spec (e.g., `list_o_auth2_clients` with underscores). Always check generated docs for exact method signatures.","severity":"gotcha","affected_versions":"all"},{"fix":"Migrate to Ory Oathkeeper for token validation; see https://www.ory.sh/docs/hydra/deprecation","message":"OAuth2 token introspection/revocation endpoints are deprecated in Hydra 2.x+ in favor of Ory OAuth2 Access Control (Ory Oathkeeper or Ory Keto). Future SDK versions may remove these methods.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Set HYDRA_ADMIN_URL=http://localhost:4445 (no slash at end)","message":"Environment variable `HYDRA_ADMIN_URL` must NOT include a trailing slash. The SDK appends paths directly.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use `from ory_hydra_client.api_client import ApiClient` or check actual class names via `help(ory_hydra_client)`.","cause":"Ory SDK is auto-generated: the main client class is named differently (e.g., `HydraAdminApi` or `ApiClient`). Package structure varies by version.","error":"ImportError: cannot import name 'OryHydraApiClient' from 'ory_hydra_client'"},{"fix":"`from ory_hydra_client.configuration import Configuration`","cause":"Configuration class is in its own submodule, not directly in the package root.","error":"AttributeError: module 'ory_hydra_client' has no attribute 'Configuration'"},{"fix":"Check method signature: `list_o_auth2_clients(limit=100, offset=0)`.","cause":"Method `list_o_auth2_clients()` does not accept `page_size`; pagination parameters differ between versions.","error":"TypeError: list() got an unexpected keyword argument 'page_size'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}