{"id":4571,"library":"ibm-platform-services","title":"IBM Cloud Platform Services Python SDK","description":"The Python client library for IBM Cloud Platform Services, providing access to various IBM Cloud platform APIs such as IAM Identity, Global Tagging, Account Management, and more. Currently at version `0.75.0`, it receives frequent updates, often on a monthly or bi-monthly cadence, incorporating new features and bug fixes derived from upstream API changes.","status":"active","version":"0.75.0","language":"en","source_language":"en","source_url":"https://github.com/IBM/platform-services-python-sdk","tags":["ibm cloud","platform services","sdk","cloud","iam","global tagging","account management"],"install":[{"cmd":"pip install ibm-platform-services","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Provides core functionalities including authenticators and base service models, essential for client interaction.","package":"ibm-cloud-sdk-core"}],"imports":[{"note":"Most service clients follow the pattern `ibm_platform_services.<service_name>_v<version_number>`.","symbol":"IamIdentityV1","correct":"from ibm_platform_services.iam_identity_v1 import IamIdentityV1"},{"note":"Authenticators are provided by `ibm-cloud-sdk-core`, a required dependency.","symbol":"IAMAuthenticator","correct":"from ibm_cloud_sdk_core.authenticators import IAMAuthenticator"}],"quickstart":{"code":"import os\nfrom ibm_platform_services.iam_identity_v1 import IamIdentityV1\nfrom ibm_cloud_sdk_core.authenticators import IAMAuthenticator\nfrom ibm_cloud_sdk_core.detailed_response import DetailedResponse\n\n# Configure API key and service URL\napi_key = os.environ.get(\"IBMCLOUD_API_KEY\", \"YOUR_IBMCLOUD_API_KEY\")\nservice_url = os.environ.get(\"IBMCLOUD_IAM_IDENTITY_SERVICE_URL\", \"https://iam.cloud.ibm.com\")\n\nif api_key == \"YOUR_IBMCLOUD_API_KEY\":\n    print(\"Please set the IBMCLOUD_API_KEY environment variable or replace 'YOUR_IBMCLOUD_API_KEY' with your actual IBM Cloud API key.\")\n    exit(1)\n\ntry:\n    # 1. Authenticate using IAMAuthenticator\n    authenticator = IAMAuthenticator(api_key)\n\n    # 2. Initialize the service client (e.g., IAM Identity Service)\n    iam_identity_service = IamIdentityV1(authenticator=authenticator)\n    iam_identity_service.set_service_url(service_url)\n\n    # 3. Perform an operation (e.g., list account settings)\n    print(\"Attempting to list account settings...\")\n    response: DetailedResponse = iam_identity_service.list_account_settings().get_result()\n    \n    print(\"Successfully retrieved account settings (first 200 chars):\\n\")\n    print(str(response)[:200] + ('...' if len(str(response)) > 200 else ''))\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    print(\"Please ensure your API key and service URL are correct and you have the necessary permissions.\")","lang":"python","description":"This quickstart demonstrates how to authenticate with an IBM Cloud API key and initialize the IAM Identity service client to list account settings. Replace `YOUR_IBMCLOUD_API_KEY` or set the `IBMCLOUD_API_KEY` environment variable. The `IBMCLOUD_IAM_IDENTITY_SERVICE_URL` is optional, defaulting to the global IAM endpoint."},"warnings":[{"fix":"Ensure you import the correct service client class, e.g., `from ibm_platform_services.iam_identity_v1 import IamIdentityV1` for the IAM Identity service.","message":"Each IBM Cloud service and its API version (e.g., `_v1`, `_v2`) has a distinct client class (e.g., `IamIdentityV1`, `GlobalTaggingV1`). Users must import the specific client for the service and version they intend to use.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Initialize your authenticator correctly (e.g., `IAMAuthenticator(api_key)`) and call `service_client.set_service_url()` if not using the default global endpoint. Prefer environment variables (`IBMCLOUD_API_KEY`, `IBMCLOUD_<SERVICE_NAME>_SERVICE_URL`) for configuration.","message":"Authentication relies on `ibm_cloud_sdk_core` authenticators (e.g., `IAMAuthenticator`), which require an IBM Cloud API key (or other credentials) and often an explicit service endpoint URL. Incorrect setup leads to authentication or connection errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Pin the library version in your `requirements.txt` or `pyproject.toml` (e.g., `ibm-platform-services==0.75.0`). Regularly review changelogs for new versions.","message":"Being in `0.x.x` version range, the library API could introduce breaking changes in minor versions, although recent releases tend to be additive. For production environments, it is recommended to pin the exact version to prevent unexpected issues.","severity":"gotcha","affected_versions":"All versions < 1.0.0"},{"fix":"Ensure your development and deployment environments are running Python 3.10 or a more recent version (e.g., Python 3.11, 3.12).","message":"The library explicitly requires Python 3.10 or newer. Attempting to install or run with older Python versions (e.g., 3.9 or earlier) will result in installation failures or runtime errors.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}