Skip to content

Commit 80a1ab6

Browse files
update 3.23.5
1 parent 4315dc7 commit 80a1ab6

20 files changed

+324
-157
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
Version 3.23.5
2+
3+
New Features:
4+
5+
1. The interface adds three types of capacity statistics to be queried: warm, cold, and deepArchiveSize
6+
2. Allowed you to add any custom header field in a request
7+
8+
Resolved Issues:
9+
10+
1. Fix the bug that regular matching fails when ECS obtains credentials through Agencies
11+
12+
-------------------------------------------------------------------------------------------------
113
Version 3.22.2
214

315
New Features:

README_CN.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
Version 3.22.2
1+
Version 3.23.5
2+
新特性:
3+
1. getBucketStorageInfo接口增加查询标准、归档、低频三种类型的容量统计
4+
2. 用户可以在发送请求时添加任意自定义头域
5+
6+
修复问题
7+
8+
1. 修复ECS通过委托获取凭证时正则匹配失败问题。
9+
10+
-------------------------------------------------------------------------------------------------
11+
Version 3.22.2
212
新特性:
313
1. 增加虚拟桶相关接口
414
2. 针对Python3 HTTPS参数的使用做了兼容修改

examples/bucket_operations_sample.py

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636

3737
def createBucket():
38-
# resp = obsClient.createBucket(bucketName)
38+
3939
resp = bucketClient.createBucket()
4040
if resp.status < 300:
4141
print('Create bucket:' + bucketName + ' successfully!\n')
@@ -44,7 +44,7 @@ def createBucket():
4444

4545

4646
def getBucketLocation():
47-
# resp = obsClient.getBucketLocation(bucketName)
47+
4848
resp = bucketClient.getBucketLocation()
4949
if resp.status < 300:
5050
print('Getting bucket location ' + str(resp.body) + ' \n')
@@ -53,7 +53,7 @@ def getBucketLocation():
5353

5454

5555
def getBucketStorageInfo():
56-
# resp = obsClient.getBucketStorageInfo(bucketName)
56+
5757
resp = bucketClient.getBucketStorageInfo()
5858
if resp.status < 300:
5959
print('Getting bucket storageInfo ' + str(resp.body) + ' \n')
@@ -63,9 +63,9 @@ def getBucketStorageInfo():
6363

6464
def doBucketQuotaOperation():
6565
# Set bucket quota to 1GB
66-
# obsClient.setBucketQuota(bucketName, 1024 * 1024 * 1024)
66+
6767
bucketClient.setBucketQuota(1024 * 1024 * 1024)
68-
# resp = obsClient.getBucketQuota(bucketName)
68+
6969
resp = bucketClient.getBucketQuota()
7070

7171
print('Getting bucket quota ' + str(resp.body) + ' \n')
@@ -75,19 +75,19 @@ def doBucketVersioningOperation():
7575
# print('Getting bucket versioning config ' + str(obsClient.getBucketVersioning(bucketName).body) + ' \n')
7676
print('Getting bucket versioning config ' + str(bucketClient.getBucketVersioning().body) + ' \n')
7777
# Enable bucket versioning
78-
# obsClient.setBucketVersioning(bucketName, 'Enabled')
78+
7979
bucketClient.setBucketVersioning('Enabled')
8080
print('Current bucket versioning config ' + str(obsClient.getBucketVersioning(bucketName).body) + ' \n')
8181

8282
# Suspend bucket versioning
83-
# obsClient.setBucketVersioning(bucketName, 'Suspended')
83+
8484
bucketClient.setBucketVersioning('Suspended')
8585
print('Current bucket versioning config ' + str(obsClient.getBucketVersioning(bucketName).body) + ' \n')
8686

8787

8888
def doBucketAclOperation():
8989
print('Setting bucket ACL to public-read \n')
90-
# obsClient.setBucketAcl(bucketName, aclControl='public-read')
90+
9191
bucketClient.setBucketAcl(aclControl='public-read')
9292

9393
# print('Getting bucket ACL ' + str(obsClient.getBucketAcl(bucketName).body) + ' \n')
@@ -109,7 +109,7 @@ def doBucketCorsOperation():
109109

110110
corsList = [cors1, cors2]
111111

112-
# obsClient.setBucketCors(bucketName, corsList)
112+
113113
bucketClient.setBucketCors(corsList)
114114

115115
# print('Getting bucket CORS ' + str(obsClient.getBucketCors(bucketName).body) + '\n')
@@ -127,7 +127,7 @@ def optionsBucket():
127127
def getBucketMetadata():
128128
print('Getting bucket metadata\n')
129129

130-
# resp = obsClient.getBucketMetadata(bucketName, origin='http://www.b.com', requestHeaders='Authorization1')
130+
131131
resp = bucketClient.getBucketMetadata(origin='http://www.b.com', requestHeaders='Authorization1')
132132
print('storageClass:', resp.body.storageClass)
133133
print('accessContorlAllowOrigin:', resp.body.accessContorlAllowOrigin)
@@ -137,7 +137,7 @@ def getBucketMetadata():
137137
print('accessContorlAllowHeaders:', resp.body.accessContorlAllowHeaders)
138138

139139
print('Deleting bucket CORS\n')
140-
# obsClient.deleteBucketCors(bucketName)
140+
141141
resp = bucketClient.deleteBucketCors()
142142
print('status' + str(resp.status))
143143

@@ -152,24 +152,24 @@ def doBucketLifycleOperation():
152152
noncurrentVersionExpiration=NoncurrentVersionExpiration(noncurrentDays=10))
153153

154154
Llifecycle = Lifecycle(rule=[rule1, rule2, rule3])
155-
# obsClient.setBucketLifecycle(bucketName, Llifecycle)
155+
156156
bucketClient.setBucketLifecycle(Llifecycle)
157157

158158
print('Getting bucket lifecycle:')
159-
# resp = obsClient.getBucketLifecycle(bucketName)
159+
160160
resp = bucketClient.getBucketLifecycle()
161161
print('\t' + str(resp.body) + '\n')
162162

163163
print('Deleting bucket lifecyle\n')
164-
# obsClient.deleteBucketLifecycle(bucketName)
164+
165165
bucketClient.deleteBucketLifecycle()
166166

167167

168168
def doBucketLoggingOperation():
169169
print('Setting bucket logging\n')
170170

171-
# obsClient.setBucketLogging(bucketName, Logging(targetBucket=bucketName,
172-
# targetPrefix='log-', agency='your agency'))
171+
172+
173173
bucketClient.setBucketLogging(Logging(targetBucket=bucketName, targetPrefix='log-', agency='your agency'))
174174

175175
print('Getting bucket logging:')
@@ -187,41 +187,35 @@ def doBucketWebsiteOperation():
187187
print('Setting bucket website\n')
188188
Lwebsite = WebsiteConfiguration(indexDocument=IndexDocument(suffix='index.html'),
189189
errorDocument=ErrorDocument(key='error.html'))
190-
# obsClient.setBucketWebsite(bucketName, Lwebsite)
191190
bucketClient.setBucketWebsite(Lwebsite)
192191

193192
print('Getting bucket website:')
194193
# print('\t' + str(obsClient.getBucketWebsite(bucketName).body) + '\n')
195194
print('\t' + str(bucketClient.getBucketWebsite().body) + '\n')
196195
print('Deleting bucket website\n')
197-
# obsClient.deleteBucketWebsite(bucketName)
198196
bucketClient.deleteBucketWebsite()
199197

200198

201199
def doBucketTaggingOperation():
202200
print('Setting bucket tagging\n')
203201
tagInfo = TagInfo()
204202
tagInfo.addTag('key1', 'value1').addTag('key2', 'value2')
205-
# resp = obsClient.setBucketTagging(bucketName, tagInfo)
206203
resp = bucketClient.setBucketTagging(tagInfo)
207204

208205
if resp.status < 300:
209206
print('Getting bucket tagging\n')
210-
# resp = obsClient.getBucketTagging(bucketName)
211207
resp = bucketClient.getBucketTagging()
212208
for item in resp.body.tagSet:
213209
print('\t' + item.key + ':' + item.value + '\n')
214210

215211
print('Deleting bucket tagging\n')
216-
# obsClient.deleteBucketTagging(bucketName)
217212
bucketClient.deleteBucketTagging()
218213
else:
219214
print('common msg:status:', resp.status, ',errorCode:', resp.errorCode, ',errorMessage:', resp.errorMessage)
220215

221216

222217
def deleteBucket():
223218
print('Deleting bucket ' + bucketName + '\n')
224-
# resp = obsClient.deleteBucket(bucketName)
225219
resp = bucketClient.deleteBucket()
226220
print('common msg:status:', resp.status, ',errorCode:', resp.errorCode, ',errorMessage:', resp.errorMessage)
227221

examples/object_operations_sample.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,32 +34,26 @@
3434

3535
# Create bucket
3636
print('Create a new bucket for demo\n')
37-
# obsClient.createBucket(bucketName)
3837
bucketClient.createBucket()
3938

4039
# Create object
41-
# resp = obsClient.putContent(bucketName, objectKey, 'Hello OBS')
4240
resp = bucketClient.putContent(objectKey, 'Hello OBS')
4341
if resp.status < 300:
4442
print('Create object ' + objectKey + ' successfully!\n')
4543

4644
# Get object metadata
4745
print('Getting object metadata')
48-
# resp = obsClient.getObjectMetadata(bucketName, objectKey, 'Hello OBS')
4946
resp = bucketClient.getObjectMetadata(objectKey, 'Hello OBS')
5047
print('\t' + str(resp.header))
5148

5249
# Get object
5350
print('Getting object content')
54-
# resp = obsClient.getObject(bucketName, objectKey, loadStreamInMemory=True)
5551
resp = bucketClient.getObject(objectKey, loadStreamInMemory=True)
5652
print('\tobject content:%s' % resp.body.buffer)
5753

5854
# Copy object
5955
print('Copying object\n')
6056
destObjectKey = objectKey + '-back'
61-
# resp = obsClient.copyObject(sourceBucketName=bucketName, sourceObjectKey=objectKey,
62-
# destBucketName=bucketName, destObjectKey=destObjectKey)
6357
resp = bucketClient.copyObject(sourceBucketName=bucketName, sourceObjectKey=objectKey, destObjectKey=destObjectKey)
6458
if resp.status < 300:
6559
print('Copy object ' + destObjectKey + ' successfully!\n')
@@ -69,18 +63,15 @@
6963
allowedOrigin=['http://www.a.com', 'http://www.b.com'], allowedHeader=['Authorization1'],
7064
maxAgeSecond=100, exposeHeader=['x-obs-test1'])
7165
corsList = [cors1]
72-
# obsClient.setBucketCors(bucketName, corsList)
7366
bucketClient.setBucketCors(corsList)
7467

7568
print('Options object:')
7669
options = Options(origin='http://www.a.com', accessControlRequestMethods=['PUT'])
77-
# resp = obsClient.optionsObject(bucketName, objectKey, options)
7870
resp = bucketClient.optionsObject(objectKey, options)
7971
print(resp.body)
8072

8173
# Put/Get object acl operations
8274
print('Setting object ACL to public-read \n')
83-
# obsClient.setObjectAcl(bucketName, objectKey, aclControl='public-read')
8475
bucketClient.setObjectAcl(objectKey, aclControl='public-read')
8576

8677
# print('Getting object ACL ' + str(obsClient.getObjectAcl(bucketName, objectKey).body) + '\n')
@@ -91,7 +82,5 @@
9182

9283
# Delete object
9384
print('Deleting objects\n')
94-
# obsClient.deleteObject(bucketName, objectKey)
95-
# obsClient.deleteObject(bucketName, destObjectKey)
9685
bucketClient.deleteObject(objectKey)
9786
bucketClient.deleteObject(destObjectKey)

examples/obs_python_sample.py

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
# init log
3434
def initLog():
35-
obsClient.initLog(LogConf('../log.conf'), 'obsclient')
35+
obsClient.initLog(LogConf('../src/log.conf'), 'obsclient')
3636

3737

3838
# create bucket
@@ -141,7 +141,6 @@ def SetBucketAcl():
141141
Lacl = ACL(owner=Lowner, grants=Lgrants)
142142

143143
resp = bucketClient.setBucketAcl(acl=Lacl)
144-
# resp = obsClient.setBucketAcl(bucketName=bucketName, aclControl='public-read-write')
145144
print('common msg:status:', resp.status, ',errorCode:', resp.errorCode, ',errorMessage:', resp.errorMessage)
146145

147146

@@ -747,65 +746,10 @@ def GetObject():
747746

748747

749748
if __name__ == '__main__':
750-
# initLog()
751749
# =========================================================
752750
# bucket operations
753751
# =========================================================
754-
# CreateBucket()
755-
# DeleteBucket()
756-
# ListBuckets()
757-
# HeadBucket()
758-
# GetBucketMetadata()
759-
# SetBucketQuota()
760-
# GetBucketQuota()
761-
# SetBucketStoragePolicy()
762-
# GetBucketStoragePolicy()
763-
# GetBucketStorageInfo()
764-
# SetBucketAcl()
765-
# GetBucketAcl()
766-
# SetBucketPolicy()
767-
# GetBucketPolicy()
768-
# DeleteBucketPolicy()
769-
# SetBucketVersioning()
770-
# GetBucketVersioning()
771-
# ListVersions()
772-
# ListObjects()
773-
# ListMultipartUploads()
774-
# SetBucketLifecycle()
775-
# GetBucketLifecycle()
776-
# DeleteBucketLifecycle()
777-
# SetBucketWebsite()
778-
# GetBucketWebsite()
779-
# DeleteBucketWebsite()
780-
# SetBucketLogging()
781-
# GetBucketLogging()
782-
# GetBucketLocation()
783-
# SetBucketTagging()
784-
# GetBucketTagging()
785-
# DeleteBucketTagging()
786-
# SetBucketCors()
787-
# GetBucketCors()
788-
# DeleteBucketCors()
789-
# SetBucketNotification()
790-
# GetBucketNotification()
791752
# =========================================================
792753
# object operations
793754
# =========================================================
794-
# PutContent()
795-
# AppendObject()
796-
# CopyObject()
797-
# PutFile()
798-
# GetObject()
799-
# GetObjectMetadata()
800-
# SetObjectAcl()
801-
# GetObjectAcl()
802-
# DeleteObject()
803-
# DeleteObjects()
804-
# RestoreObject()
805-
# AbortMultipartUpload()
806-
# InitiateMultipartUpload()
807-
# UploadPart()
808-
# CompleteMultipartUpload()
809-
# CopyPart()
810-
# ListParts()
811755
pass
80.6 KB
Binary file not shown.

src/obs/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from obs.client import ObsClient
1717
from obs.model import CompletePart, Permission, StorageClass, EventType, RestoreTier, Group, Grantee, Grant
1818
from obs.model import ExtensionGrant, Owner, ACL, Condition, DateTime, SseCHeader, SseKmsHeader, CopyObjectHeader
19-
from obs.model import SetObjectMetadataHeader, CorsRule, CreateBucketHeader, ErrorDocument, IndexDocument, Expiration
19+
from obs.model import SetObjectMetadataHeader,RenameFileHeader, CorsRule, CreateBucketHeader, ErrorDocument, IndexDocument, Expiration
2020
from obs.model import NoncurrentVersionExpiration, GetObjectHeader, HeadPermission, Lifecycle, Notification
2121
from obs.model import TopicConfiguration, FunctionGraphConfiguration, FilterRule, Replication, ReplicationRule
2222
from obs.model import Options, PutObjectHeader, AppendObjectHeader, AppendObjectContent, RedirectAllRequestTo
@@ -49,6 +49,7 @@
4949
'SseKmsHeader',
5050
'CopyObjectHeader',
5151
'SetObjectMetadataHeader',
52+
'RenameFileHeader',
5253
'CorsRule',
5354
'CreateBucketHeader',
5455
'ErrorDocument',

0 commit comments

Comments
 (0)