SDK for Python Cloud Shell Quick Start

This section discusses how to quickly get started with the Oracle Cloud Infrastructure SDK for Python using Cloud Shell.

This section discusses how to quickly get started with the Oracle Cloud Infrastructure SDK for Python using Cloud Shell.

  1. Login to the Console.
  2. Click the Cloud Shell icon in the Console header. Note that Cloud Shell will execute commands against the region selected in the Console's Region selection menu when Cloud Shell was started.
  3. Run Python:
    user@cloudshell:oci (us-phoenix-1)$ python3
    Python 3.6.8 (default, Oct  1 2020, 20:32:44) 
    [GCC 4.8.5 20150623 (Red Hat 4.8.5-44.0.3)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 
  4. Run the following code sample to see your current Object Storage namespace:
    import oci
    object_storage_client = oci.object_storage.ObjectStorageClient(oci.config.from_file())
    result = object_storage_client.get_namespace()
    print("Current object storage namespace: {}".format(result.data))
    This will return output similar to the following:
    Current object storage namespace: mynamespace