• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. Developer Guide (Python SDK)
  4. Quick Start
  5. Downloading an Object

Downloading an Object

Sample code:

resp = obsClient.getObject('bucketname', 'objectkey')
if resp.status < 300:    
    print('requestId:', resp.requestId)
    if resp.body and resp.body.response:
        while True:
            chunk = resp.body.response.read(65536)
            if not chunk:
                break
            print(chunk)
        resp.body.response.close()
else:    
    print('errorCode:', resp.errorCode)
    print('errorMessage:', resp.errorMessage)
NOTE:

For more information, see Object Download.