Skip to content

Commit 38d56e2

Browse files
zhuxiaolong37huiguangjun
authored andcommitted
optimized code
1 parent 80f455d commit 38d56e2

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

sample/get_object.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,20 @@ def main():
2828
bucket=args.bucket,
2929
key=args.key,
3030
))
31+
32+
# Load all the data into memory and then process it.
33+
with result.body as f:
34+
data = f.read()
35+
# TODO
36+
37+
# # Read a block, process a block.
38+
# with result.body as f:
39+
# # You can control the size of the data returned each time by setting the block_size parameter.
40+
# # for chunk in f.iter_bytes(block_size=256*1024):
41+
# for chunk in f.iter_bytes():
42+
# # TODO
43+
# pass
44+
3145
print(f'status code: {result.status_code},'
3246
f' request id: {result.request_id},'
3347
f' content length: {result.content_length},'

sample/restore_object.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def main():
3232
days=1,
3333
# The restoration priority of Cold Archive or Deep Cold Archive objects.
3434
# Valid values:Expedited,Standard,Bulk
35-
tier="Expedited",
35+
tier="Standard",
3636
)
3737
))
3838

0 commit comments

Comments
 (0)