當前位置: 首頁>>代碼示例>>Python>>正文


Python File.metadata['foo']方法代碼示例

本文整理匯總了Python中leancloud.File.metadata['foo']方法的典型用法代碼示例。如果您正苦於以下問題:Python File.metadata['foo']方法的具體用法?Python File.metadata['foo']怎麽用?Python File.metadata['foo']使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在leancloud.File的用法示例。


在下文中一共展示了File.metadata['foo']方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_fetch

# 需要導入模塊: from leancloud import File [as 別名]
# 或者: from leancloud.File import metadata['foo'] [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()
開發者ID:lord63-forks,項目名稱:python-sdk,代碼行數:17,代碼來源:test_file.py

示例2: test_fetch

# 需要導入模塊: from leancloud import File [as 別名]
# 或者: from leancloud.File import metadata['foo'] [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()
開發者ID:leancloud,項目名稱:python-sdk,代碼行數:20,代碼來源:test_file.py


注:本文中的leancloud.File.metadata['foo']方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。