Use the address to access Object Storage s3.coldstack.io.
Example
#!/usr/bin/env python#-*- coding: utf-8 -*-import boto3session = boto3.session.Session()s3 = session.client( service_name='s3', endpoint_url='https://s3.coldstack.io')# Uploading objects to the bucket## From a strings3.put_object(Bucket='bucket-name', Key='object_name', Body='TEST', StorageClass='COLD')## From a files3.upload_file('this_script.py', 'bucket-name', 'py_script.py')s3.upload_file('this_script.py', 'bucket-name', 'script/py_script.py')# Get a list of objects in bucketfor key in s3.list_objects(Bucket='bucket-name')['Contents']:print(key['Key'])# Download an object and print the contents to the consoleget_object_response = s3.get_object(Bucket='bucket-name',Key='py_script.py')print(get_object_response['Body'].read())
#!/usr/bin/env python#-*- coding: utf-8 -*-import osfrom boto.s3.key import Keyfrom boto.s3.connection import S3Connectionos.environ['S3_USE_SIGV4']='True'conn =S3Connection( host='s3.coldstack.io')conn.auth_region_name ='us-east-1'# Создать новый бакетconn.create_bucket('bucket-name')bucket = conn.get_bucket('bucket-name')# Загрузить объекты в бакет## Из строкиbucket.new_key('test-string').set_contents_from_string('TEST')## Из файлаfile_key_1 =Key(bucket)file_key_1.key ='py_script.py'file_key_1.set_contents_from_filename('this_script.py')file_key_2 =Key(bucket)file_key_2.key ='script/py_script.py'file_key_2.set_contents_from_filename('this_script.py')# Получить список объектов в бакетеkeys_list=bucket.list()for key in keys_list:print key.key# Удалить несколько объектовresponse = bucket.delete_keys(['test-string', 'py_script.py'])# Получить объектkey = bucket.get_key('script/py_script.py')print key.get_contents_as_string()