def test_write_qr_image(self): service = Googl() service.write_qr_image(self.test_short_url, self.qr_image_path) self.assertEqual('png', imghdr.what(self.qr_image_path))
def test_write_qr_image(self): service = Googl() service.write_qr_image(self.test_short_url, self.qr_image_path) self.assertEqual('png', imghdr.what(self.qr_image_path))
elif 'tinyurl.com' == options.service: service = TinyUrlcom() elif 'v.gd' == options.service: service = Vgd() elif 'is.gd' == options.service: service = Isgd() # Get QR code. if options.qr_img_path: if not options.short_url: print 'You need to specify a short url to get qr code.' print 'Usage: python %s -s <short_url> -q <image_path>' %(sys.argv[0]) sys.exit(-1) try: service.write_qr_image(options.short_url, options.qr_img_path) except ShortenerServiceError, e: print e if os.path.exists(options.qr_img_path): print 'Wrote the QR code for %s to %s' %(options.short_url, options.qr_img_path) sys.exit(0) # Shorten a URL. if options.long_url: try: if 'bit.ly' == options.service and options.domain: short_url = service.shorten_url(options.long_url, domain=options.domain) else: short_url = service.shorten_url(options.long_url) print short_url
service = TinyUrlcom() elif 'v.gd' == options.service: service = Vgd() elif 'is.gd' == options.service: service = Isgd() # Get QR code. if options.qr_img_path: if not options.short_url: print 'You need to specify a short url to get qr code.' print 'Usage: python %s -s <short_url> -q <image_path>' % ( sys.argv[0]) sys.exit(-1) try: service.write_qr_image(options.short_url, options.qr_img_path) except ShortenerServiceError, e: print e if os.path.exists(options.qr_img_path): print 'Wrote the QR code for %s to %s' % (options.short_url, options.qr_img_path) sys.exit(0) # Shorten a URL. if options.long_url: try: if 'bit.ly' == options.service and options.domain: short_url = service.shorten_url(options.long_url, domain=options.domain) else: