本文整理汇总了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)
示例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)
示例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
示例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'