当前位置: 首页>>代码示例>>Python>>正文


Python Storage.get方法代码示例

本文整理汇总了Python中thumbor.storages.mongo_storage.Storage.get方法的典型用法代码示例。如果您正苦于以下问题:Python Storage.get方法的具体用法?Python Storage.get怎么用?Python Storage.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在thumbor.storages.mongo_storage.Storage的用法示例。


在下文中一共展示了Storage.get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_before_expiration_returns_something

# 需要导入模块: from thumbor.storages.mongo_storage import Storage [as 别名]
# 或者: from thumbor.storages.mongo_storage.Storage import get [as 别名]
 def test_before_expiration_returns_something(self):
     rm_storage()
     options.STORAGE_EXPIRATION_SECONDS = 1000
     image_url = 'www.globo.com/media/globocom/img/sprite1.png'
     http_loaded = http.load(image_url)
     storage = Storage()
     storage.put(image_url, http_loaded)
     assert storage.get(image_url)
开发者ID:cezarsa,项目名称:thumbor,代码行数:10,代码来源:test_mongo_storage.py

示例2: topic

# 需要导入模块: from thumbor.storages.mongo_storage import Storage [as 别名]
# 或者: from thumbor.storages.mongo_storage.Storage import get [as 别名]
 def topic(self):
     conf = Config(
         MONGO_STORAGE_SERVER_PORT=7777, STORES_CRYPTO_KEY_FOR_EACH_IMAGE=True,
         STORAGE_EXPIRATION_SECONDS=5000
     )
     server = get_server('ACME-SEC')
     storage = MongoStorage(Context(server=server, config=conf))
     storage.put(IMAGE_URL % 8, IMAGE_BYTES)
     return storage.get(IMAGE_URL % 8)
开发者ID:SONIFI,项目名称:thumbor,代码行数:11,代码来源:mongo_storage_vows.py

示例3: test_after_expiration_returns_none

# 需要导入模块: from thumbor.storages.mongo_storage import Storage [as 别名]
# 或者: from thumbor.storages.mongo_storage.Storage import get [as 别名]
 def test_after_expiration_returns_none(self):
     rm_storage()
     options.STORAGE_EXPIRATION_SECONDS = 1
     image_url = 'www.globo.com/media/globocom/img/sprite1.png'
     http_loaded = http.load(image_url)
     storage = Storage()
     storage.put(image_url, http_loaded)
     time.sleep(2)
     assert storage.get(image_url) is None
开发者ID:cezarsa,项目名称:thumbor,代码行数:11,代码来源:test_mongo_storage.py

示例4: test_gets_image

# 需要导入模块: from thumbor.storages.mongo_storage import Storage [as 别名]
# 或者: from thumbor.storages.mongo_storage.Storage import get [as 别名]
 def test_gets_image(self):
     rm_storage()
     options.STORES_CRYPTO_KEY_FOR_EACH_IMAGE = False
     image_url = 'www.globo.com/media/globocom/img/sprite1.png'
     http_loaded = http.load(image_url)
     storage = Storage()
     storage.put(image_url, http_loaded)
     stored_image = storage.get(image_url)
     assert stored_image and not isinstance(stored_image, dict), 'image not found into the storage'
     assert http_loaded == stored_image, 'stored image did not match the loaded one'
开发者ID:cezarsa,项目名称:thumbor,代码行数:12,代码来源:test_mongo_storage.py


注:本文中的thumbor.storages.mongo_storage.Storage.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。