本文整理匯總了Python中leancloud.File.create_without_data方法的典型用法代碼示例。如果您正苦於以下問題:Python File.create_without_data方法的具體用法?Python File.create_without_data怎麽用?Python File.create_without_data使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類leancloud.File
的用法示例。
在下文中一共展示了File.create_without_data方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_fetch
# 需要導入模塊: from leancloud import File [as 別名]
# 或者: from leancloud.File import create_without_data [as 別名]
def test_fetch():
r = requests.get('http://i1.wp.com/leancloud.cn/images/static/default-avatar.png')
b = buffer(r.content)
f = File('Lenna2.jpg', b)
f.metadata['foo'] = 'bar'
f.save()
fetched = File.create_without_data(f.id)
fetched.fetch()
assert fetched.id == f.id
assert fetched.metadata == f.metadata
assert fetched.name == f.name
assert fetched.url == f.url
assert fetched.size == f.size
assert fetched.url == f.url
f.destroy()
示例2: test_fetch
# 需要導入模塊: from leancloud import File [as 別名]
# 或者: from leancloud.File import create_without_data [as 別名]
def test_fetch(): # type: () -> None
r = requests.get('http://i1.wp.com/leancloud.cn/images/static/default-avatar.png')
b = io.BytesIO(r.content)
f = File('Lenna2.jpg', b)
f.metadata['foo'] = 'bar'
f.save()
fetched = File.create_without_data(f.id)
fetched.fetch()
normalized_f_url = f.url.split('/')[-1]
normalized_fetched_url = f.url.split('/')[-1]
assert fetched.id == f.id
assert fetched.metadata == f.metadata
assert fetched.name == f.name
assert fetched.size == f.size
assert fetched.url == f.url or normalized_fetched_url == normalized_f_url
f.destroy()
示例3: test_create_without_data
# 需要導入模塊: from leancloud import File [as 別名]
# 或者: from leancloud.File import create_without_data [as 別名]
def test_create_without_data():
f = File.create_without_data(123)
assert f.id == 123
示例4: test_create_without_data
# 需要導入模塊: from leancloud import File [as 別名]
# 或者: from leancloud.File import create_without_data [as 別名]
def test_create_without_data(): # type: () -> None
f = File.create_without_data('a123')
assert f.id == 'a123'