• Object Storage Service

  1. Help Center
  2. Object Storage Service
  3. Developer Guide (Python SDK)
  4. Versioning Management
  5. Restoring a Versioning Cold Object

Restoring a Versioning Cold Object

You can call ObsClient.restoreObject to pass the version ID (versionId) to restore a versioning Cold object. 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 ***',    

obsClient.restoreObject('bucketname', 'objectkey', days=1, versionId='versionid')

if resp.status < 300:
    print('requestId:', resp.requestId)
    print('errorCode:', resp.errorCode)
    print('errorMessage:', resp.errorMessage)