• Object Storage Service

  1. Help Center
  2. Object Storage Service
  3. Developer Guide (Python SDK)
  4. Object Upload
  5. Performing a Text-Based Upload

Performing a Text-Based Upload

Text-based upload is used to directly upload character strings. You can call ObsClient.putContent to upload character strings to OBS. Sample code is as follows:

# Import the module.
from com.obs.client.obs_client import ObsClient

# Create an instance of ObsClient.
obsClient = ObsClient(
    access_key_id='*** Provide your Access Key ***',    
    secret_access_key='*** Provide your Secret Key ***',    
resp = obsClient.putContent('bucketname', 'objectkey', content='Hello OBS')
if resp.status < 300:
    print('requestId:', resp.requestId)
    print('etag:', resp.body.etag)
    print('errorCode:', resp.errorCode)
    print('errorMessage:', resp.errorMessage)