本文整理汇总了Python中pyshorteners.shorteners.Shortener.qrcode方法的典型用法代码示例。如果您正苦于以下问题:Python Shortener.qrcode方法的具体用法?Python Shortener.qrcode怎么用?Python Shortener.qrcode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyshorteners.shorteners.Shortener
的用法示例。
在下文中一共展示了Shortener.qrcode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_sentala_shortener
# 需要导入模块: from pyshorteners.shorteners import Shortener [as 别名]
# 或者: from pyshorteners.shorteners.Shortener import qrcode [as 别名]
def test_sentala_shortener(self):
engine = 'SentalaShortener'
short = Shortener(engine)
url = 'http://www.pilgrims.com'
shorten = short.short(url)
expand = short.expand(shorten)
self.assertEqual(expand, url)
self.assertEqual(short.qrcode(), 'http://chart.apis.google.com/'
'chart?cht=qr&chl={}&chs=120x120'.format(shorten))
示例2: test_qrcx_shortener
# 需要导入模块: from pyshorteners.shorteners import Shortener [as 别名]
# 或者: from pyshorteners.shorteners.Shortener import qrcode [as 别名]
def test_qrcx_shortener(self):
engine = 'QrCxShortener'
short = Shortener(engine)
url = 'https://www.facebook.com/'
shorten = short.short(url)
expand = short.expand(shorten)
self.assertEqual(expand, url)
self.assertEqual(short.qrcode(), 'http://chart.apis.google.com/'
'chart?cht=qr&chl={}&chs=120x120'.format(shorten))
示例3: test_tinyurl_shortener
# 需要导入模块: from pyshorteners.shorteners import Shortener [as 别名]
# 或者: from pyshorteners.shorteners.Shortener import qrcode [as 别名]
def test_tinyurl_shortener(self):
engine = 'TinyurlShortener'
short = Shortener(engine)
url = 'http://tinyurl.com/nc9m936'
shorten = short.short(self.test_url)
self.assertEqual(shorten, url)
self.assertEqual(short.expand(), self.test_url)
self.assertEqual(short.expand(url), self.test_url)
self.assertEqual(short.expanded, self.test_url)
self.assertEqual(short.shorten, url)
self.assertEqual(short.qrcode(), 'http://chart.apis.google.com/'
'chart?cht=qr&chl={}&chs=120x120'.format(shorten))
示例4: test_googl_shortener
# 需要导入模块: from pyshorteners.shorteners import Shortener [as 别名]
# 或者: from pyshorteners.shorteners.Shortener import qrcode [as 别名]
def test_googl_shortener(self):
engine = 'GoogleShortener'
short = Shortener(engine)
url = 'http://goo.gl/rjf0oI'
shorten = short.short(self.test_url)
self.assertEqual(shorten, url)
self.assertEqual(short.expand(), self.test_url)
self.assertEqual(short.expanded, self.test_url)
self.assertEqual(short.shorten, url)
self.assertEqual(short.qrcode(), 'http://chart.apis.google.com/'
'chart?cht=qr&chl={}&chs=120x120'.format(shorten))
#test exceptions
with self.assertRaises(ExpandingErrorException):
short.expand('http://www.a.co')
示例5: test_none_qrcode
# 需要导入模块: from pyshorteners.shorteners import Shortener [as 别名]
# 或者: from pyshorteners.shorteners.Shortener import qrcode [as 别名]
def test_none_qrcode(self):
shortener = Shortener('TinyurlShortener')
self.assertIsNone(shortener.qrcode())