本文整理汇总了Python中thumbor.url.Url.parse方法的典型用法代码示例。如果您正苦于以下问题:Python Url.parse方法的具体用法?Python Url.parse怎么用?Python Url.parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thumbor.url.Url
的用法示例。
在下文中一共展示了Url.parse方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_parse_urls_with_image
# 需要导入模块: from thumbor.url import Url [as 别名]
# 或者: from thumbor.url.Url import parse [as 别名]
def test_parse_urls_with_image():
image_url = 's.glbimg.com/es/ge/f/original/2011/03/29/orlandosilva_60.jpg'
options = Url.parse('/unsafe/meta/10x11:12x13/-300x-200/left/top/smart/%s' % image_url)
assert options['image']
assert options['image'] == image_url
options = Url.parse('unsafe/meta/10x11:12x13/-300x-200/left/top/smart/%s' % image_url)
assert options['image']
assert options['image'] == image_url
示例2: decrypt
# 需要导入模块: from thumbor.url import Url [as 别名]
# 或者: from thumbor.url.Url import parse [as 别名]
def decrypt(self, encrypted):
cipher = AES.new(self.salt)
debased = base64.urlsafe_b64decode(encrypted.encode("utf-8"))
decrypted = cipher.decrypt(debased).rstrip('{')
result = Url.parse('/%s' % decrypted, with_unsafe=False)
result['image_hash'] = result['image']
del result['image']
return result
示例3: decrypt
# 需要导入模块: from thumbor.url import Url [as 别名]
# 或者: from thumbor.url.Url import parse [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("/%s" % decrypted)
result["image_hash"] = result["image"]
del result["image"]
return result
示例4: decrypt
# 需要导入模块: from thumbor.url import Url [as 别名]
# 或者: from thumbor.url.Url import parse [as 别名]
def decrypt(self, encrypted):
cipher = AES.new(self.salt)
debased = base64.urlsafe_b64decode(encrypted)
decrypted = cipher.decrypt(debased).rstrip('{')
if not decrypted or not urlparse.urlparse(decrypted):
return None
result = Url.parse('/%s' % decrypted, with_unsafe=False)
if not result:
return None
result['image_hash'] = result['image']
del result['image']
return result
示例5: topic
# 需要导入模块: from thumbor.url import Url [as 别名]
# 或者: from thumbor.url.Url import parse [as 别名]
def topic(self):
image_url = 's.glbimg.com/es/ge/f/original/2011/03/29/orlandosilva_60.jpg'
return Url.parse('/unsafe/meta/10x11:12x13/-300x-200/left/top/smart/%s' % image_url)