CloudShell Core

raw JSON →
2.2.180 verified Sat May 09 auth: no python

Core package for CloudShell Python orchestration and automation. Provides common utilities including logging, basic interfaces, and other infrastructure for CloudShell packages. Current version 2.2.180, updated frequently.

pip install cloudshell-core
error ModuleNotFoundError: No module named 'cloudshell_core'
cause Trying to import the package name with underscore instead of the correct import path.
fix
Use 'import cloudshell' or 'from cloudshell.core import ...'.
error ImportError: cannot import name 'CloudShellCoreContext' from 'cloudshell'
cause Top-level cloudshell package does not re-export all submodules; need full dotted path.
fix
Use 'from cloudshell.core.context import CloudShellCoreContext'.
error AttributeError: 'NoneType' object has no attribute 'send_request'
cause QualiApiClient initialized without a valid context or token.
fix
Ensure CloudShellCoreContext is properly configured with server_host, api_port, and api_token.
breaking Version 2.0.0 introduced many breaking changes, including restructuring of imports. Code from v1.x (e.g., from cloudshell.core.xyz) may not work directly.
fix Update all imports to use cloudshell.core subpackage pattern (e.g., from cloudshell.core.logger import ...). Consult changelog for full migration.
gotcha Package name on PyPI is 'cloudshell-core' with a hyphen, but Python imports use 'cloudshell' (no hyphen, no underscore). Many new users mistakenly try 'import cloudshell_core'.
fix Use 'import cloudshell' or 'from cloudshell.core import ...'.
deprecated Using 'cloudshell.api.QualiApiClient' without proper context may lead to authentication issues in newer versions.
fix Always inject CloudShellCoreContext when creating ApiClient instances.

Initialize CloudShell context and a logger session.

from cloudshell.core.logger import LoggerSession
from cloudshell.core.context import CloudShellCoreContext
import os

cs_context = CloudShellCoreContext(
    server_host=os.environ.get('CLOUDSHELL_SERVER_HOST', 'localhost'),
    api_port=9000,
    api_token=os.environ.get('CLOUDSHELL_API_TOKEN', '')
)
logger = LoggerSession('my_logger', cs_context)
print('Context and logger created successfully')