本文整理汇总了Python中sinastorage.bucket.SCSBucket.make_url_authed方法的典型用法代码示例。如果您正苦于以下问题:Python SCSBucket.make_url_authed方法的具体用法?Python SCSBucket.make_url_authed怎么用?Python SCSBucket.make_url_authed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sinastorage.bucket.SCSBucket
的用法示例。
在下文中一共展示了SCSBucket.make_url_authed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_make_url_authed
# 需要导入模块: from sinastorage.bucket import SCSBucket [as 别名]
# 或者: from sinastorage.bucket.SCSBucket import make_url_authed [as 别名]
def test_make_url_authed(self):
scs = SCSBucket(self.bucket_name)
try:
scs.put_bucket('private')
except:
self.fail('create bucket:%s is failed'%self.bucket_name)
content = u'this is a file content text!!'
canned_acl = 'private' #快捷ACL
scs.put(key=self.object_key, data=content, acl=canned_acl)
url = scs.make_url_authed(key=self.object_key,expire=datetime.timedelta(minutes=5))
#下载文件
# import urllib2
# response = urllib2.urlopen(url)
from sinastorage.compat import urllib
response = urllib.request.urlopen(url)
self.assertEqual(len(content), int(response.info()['Content-Length']), 'The response header Content-Length is not match')
示例2: make_url_authed
# 需要导入模块: from sinastorage.bucket import SCSBucket [as 别名]
# 或者: from sinastorage.bucket.SCSBucket import make_url_authed [as 别名]
def make_url_authed():
s = SCSBucket('test11')
return s.make_url_authed('testpdf.pdf')