Registry / aws / ibm-cloud-sdk-core

ibm-cloud-sdk-core

JSON →
library3.26.0pypypi✓ verified 24d ago

The `ibm-cloud-sdk-core` library provides essential functionalities like authentication, request signing, and utility methods for Python SDKs targeting IBM Cloud services. It is actively maintained with frequent patch releases addressing security and bug fixes, and periodic minor releases introducing new features or authenticators.

pip install ibm-cloud-sdk-core
INSTALL
IMPORT
SIG · IBM-CLOUD-SDK-CORE
I
ibm-cloud-sdk-core
awspythonv3.26.0
Install
2.7s avg
Import
425ms
Disk
21MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.26.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.438s · 23MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.7s · import 0.412s · 24MB
21MB installed
● package 21MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

IAMAuthenticator
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
BearerTokenAuthenticator
from ibm_cloud_sdk_core.authenticators import BearerTokenAuthenticator
NoAuthAuthenticator
from ibm_cloud_sdk_core.authenticators import NoAuthAuthenticator
get_authenticator_from_external_sources
from ibm_cloud_sdk_core.authenticators import get_authenticator_from_external_sources
from ibm_cloud_sdk_core.utils import get_authenticator_from_external_sources
Previously this utility might have been in `utils`, but it is now correctly in `authenticators`.

This quickstart demonstrates how to instantiate an `IAMAuthenticator` using an API key (preferably from an environment variable) and then shows how a `BaseService` (the foundation for IBM Cloud service clients) would integrate with this authenticator. Replace `YOUR_IBMCLOUD_API_KEY` and `https://api.example.com` with actual values for your service.

import os from ibm_cloud_sdk_core.authenticators import IAMAuthenticator from ibm_cloud_sdk_core.base_service import BaseService # Instantiate an authenticator using an API key from environment variables api_key = os.environ.get('IBMCLOUD_API_KEY', 'YOUR_IBMCLOUD_API_KEY') service_url = os.environ.get('IBMCLOUD_SERVICE_URL', 'https://api.example.com') if api_key == 'YOUR_IBMCLOUD_API_KEY': print("Warning: Please set the IBMCLOUD_API_KEY environment variable or replace the placeholder.") authenticator = IAMAuthenticator(api_key) # Example of creating a dummy service client that uses this authenticator class MyDummyService(BaseService): DEFAULT_SERVICE_URL = service_url def __init__(self, authenticator_instance): super().__init__( service_url=MyDummyService.DEFAULT_SERVICE_URL, authenticator=authenticator_instance ) def do_something(self): # In a real SDK, this would make an API call print(f"Dummy service initialized with authenticator type: {type(self.authenticator).__name__}") print(f"Service URL: {self.service_url}") # Initialize and use the dummy service dummy_service = MyDummyService(authenticator) dummy_service.do_something()
Debug
Known issues
breakingMajor breaking changes occurred between v2.x and v3.x, including a package rename from `ibm_sdk_core` to `ibm_cloud_sdk_core`. Direct imports and configuration methods for authenticators likely require updates.
fix
Update package name in `pip install` and all `import` statements. Review authenticator instantiation and configuration methods as per the latest documentation.
affects: >=3.0.0 (from 2.x)
gotchaThe library primarily serves as a foundation for other IBM Cloud SDKs. While you can directly use its authenticators, for interacting with specific IBM Cloud services (e.g., Object Storage, Watson APIs), you will typically install and use the dedicated Python SDK for that service, which in turn depends on and uses `ibm-cloud-sdk-core`.
fix
For service-specific interactions, identify and install the correct IBM Cloud Python SDK (e.g., `ibm-cos-sdk`, `ibm-watson`). Use `ibm-cloud-sdk-core` directly when you need advanced control over authentication or request handling for multiple services.
affects: All versions
gotchaConfiguration for authenticators (API keys, service URLs) can be sourced from constructor arguments, environment variables (e.g., `IBMCLOUD_API_KEY`, `IBMCLOUD_AUTH_TYPE`), or configuration files. Understand the precedence rules to avoid unexpected authentication failures.
fix
Consult the official documentation for the precise order of precedence. Generally, constructor arguments take highest priority, followed by environment variables, then configuration files. Explicitly setting values is often the clearest approach.
affects: All versions
gotchaThe library frequently updates its dependencies (like `requests` and `PyJWT`) to address security vulnerabilities (CVEs). Older versions of `ibm-cloud-sdk-core` might pin to vulnerable versions of these indirect dependencies.
fix
Regularly update `ibm-cloud-sdk-core` to the latest minor or patch version using `pip install --upgrade ibm-cloud-sdk-core` to ensure you benefit from security fixes in its dependencies.
affects: <3.24.4 (for PyJWT), <3.24.2 (for requests)
deprecatedOlder authenticator types or parameters might be deprecated in favor of new, more secure, or more flexible options. For example, `IAMAuthenticator` and `ContainerAuthenticator` have seen feature additions over time.
fix
Check the release notes for new authenticator features or deprecation warnings. Migrate to newer authenticator types or configurations when available to leverage new capabilities and ensure future compatibility.
affects: <3.24.0 (for MCSP V2 auth), <3.23.0 (for Code Engine workload support)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'ibm_cloud_sdk_core'
The `ibm-cloud-sdk-core` library is not installed in the Python environment.
fix
Install the library using pip: `python -m pip install --upgrade ibm-cloud-sdk-core`
401 Unauthorized: Access is denied due to invalid credentials.
The credentials (e.g., API key, bearer token, username/password) provided for authentication are incorrect, expired, or lack the necessary permissions for the requested operation or service endpoint. This often includes specific messages like 'invalid_grant' indicating a problem with obtaining or refreshing an access token.
fix
Verify that your API key is correct and active, the service endpoint URL is accurate for your region, and the authenticated identity has the required IAM roles and permissions. Ensure IAM access tokens are correctly generated and refreshed, or provide valid `username` and `password` for basic authentication.
IamAuthenticator is not a constructor
This error occurs when attempting to instantiate `IamAuthenticator` incorrectly, often by importing it from the wrong module or treating it as a regular function instead of a class.
fix
Ensure `IamAuthenticator` is imported from `ibm_cloud_sdk_core.authenticators` and instantiated as a class: `from ibm_cloud_sdk_core.authenticators import IamAuthenticator` then `authenticator = IamAuthenticator(apikey='YOUR_API_KEY')`
Upgrade
Version history
3.26.0latest on PyPI · released Jul 16, 2026
Audit
Dependencies
requestsrequiredUsed for HTTP requests, regularly updated for security fixes (e.g., CVEs).
PyJWTrequiredRequired for JWT-based authentication, updated for security fixes.
DeprecatedrequiredUsed for marking deprecated features, part of the core SDK infrastructure.
Agent activity
34 hits · last 30 days
node
31
OpenAI (training)
1
Resources
ibm-cloud-sdk-core — pip install ibm-cloud-sdk-core · libregistry