本文整理汇总了Python中thumbor.url.Url.parse_decrypted方法的典型用法代码示例。如果您正苦于以下问题:Python Url.parse_decrypted方法的具体用法?Python Url.parse_decrypted怎么用?Python Url.parse_decrypted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thumbor.url.Url
的用法示例。
在下文中一共展示了Url.parse_decrypted方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_parsing_complete_url
# 需要导入模块: from thumbor.url import Url [as 别名]
# 或者: from thumbor.url.Url import parse_decrypted [as 别名]
def test_parsing_complete_url(self):
url = '/debug/meta/trim/300x200:400x500/adaptive-full-fit-in/-300x-400/' \
'left/top/smart/filters:brightness(100)/some/image.jpg'
expected = {
'trim': 'trim',
'full': True,
'halign': 'left',
'fit_in': True,
'vertical_flip': True,
'image': 'some/image.jpg',
'crop': {'top': 200, 'right': 400, 'bottom': 500, 'left': 300},
'height': 400,
'width': 300,
'meta': True,
'horizontal_flip': True,
'filters': 'brightness(100)',
'valign': 'top',
'debug': True,
'adaptive': True,
'smart': True,
}
result = Url.parse_decrypted(url)
expect(result).not_to_be_null()
expect(result).to_be_like(expected)
# do it again to use compiled regex
result = Url.parse_decrypted(url)
expect(result).not_to_be_null()
expect(result).to_be_like(expected)
示例2: decrypt
# 需要导入模块: from thumbor.url import Url [as 别名]
# 或者: from thumbor.url.Url import parse_decrypted [as 别名]
def decrypt(self, encrypted):
cipher = AES.new(self.security_key)
try:
debased = base64.urlsafe_b64decode(encrypted.encode("utf-8"))
decrypted = cipher.decrypt(debased).rstrip('{')
except TypeError:
return None
result = Url.parse_decrypted('/%s' % decrypted)
result['image_hash'] = result['image']
del result['image']
return result
示例3: test_parsing_invalid_url
# 需要导入模块: from thumbor.url import Url [as 别名]
# 或者: from thumbor.url.Url import parse_decrypted [as 别名]
def test_parsing_invalid_url(self):
expect(Url.compiled_regex).to_be_null()
url = ""
expect(Url.parse_decrypted(url)).to_be_null()
示例4: topic
# 需要导入模块: from thumbor.url import Url [as 别名]
# 或者: from thumbor.url.Url import parse_decrypted [as 别名]
def topic(self):
return Url.parse_decrypted(
'/filters:watermark(s.glbimg.com/es/ge/f/original/2011/03/29/orlandosilva_60.jpg,0,0,0):brightness(-50):grayscale()/img')
示例5: topic
# 需要导入模块: from thumbor.url import Url [as 别名]
# 或者: from thumbor.url.Url import parse_decrypted [as 别名]
def topic(self):
return Url.parse_decrypted(
'/90x100/my.image.path/unsafe/filters:watermark(s.glbimg.com/some/image.jpg,0,0,0)'
'/some.domain/img/path/img.jpg')
示例6: topic
# 需要导入模块: from thumbor.url import Url [as 别名]
# 或者: from thumbor.url.Url import parse_decrypted [as 别名]
def topic(self):
return Url.parse_decrypted(
"/filters:watermark(s.glbimg.com/es/ge/f/original/2011/03/29/orlandosilva_60.jpg,0,0,0)/img"
)