Skip to content

修改了object_basic中的文件,让它能成功运行并且具有更好的可视化效果 #248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions examples/object_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

import oss2

import datetime


# 以下代码展示了基本的文件上传、下载、罗列、删除用法。

Expand Down Expand Up @@ -35,10 +37,10 @@
bucket.put_object('motto.txt', 'Never give up. - Jack Ma')

# 获取Object的metadata
object_meta = bucket.get_object_meta('你的对象名')
print('last modified: ' + object_meta.last_modified)
object_meta = bucket.get_object_meta('motto.txt')
print('last modified: ' +datetime.datetime.fromtimestamp(object_meta.last_modified).strftime('%Y-%m-%d %H:%M:%S'))
print('etag: ' + object_meta.etag)
print('size: ' + object_meta.content_length)
print('size: ' + str(object_meta.content_length))

# 下载到本地文件
bucket.get_object_to_file('motto.txt', '本地文件名.txt')
Expand Down