예제 #1
0
    def test_expand_url_without_key(self):
        service = Googl()
        generated_long_url = service.expand_url(self.test_short_url)

        self.assertEqual(self.test_long_url, generated_long_url)
예제 #2
0
    def test_expand_url_without_key(self):
        service = Googl()
        generated_long_url = service.expand_url(self.test_short_url)

        self.assertEqual(self.test_long_url, generated_long_url)
예제 #3
0
        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
        except ShortenerServiceError, e:
            print e
        sys.exit(0)

    # Expand a short url.
    if options.short_url:
        try:
            long_url = service.expand_url(options.short_url)
            print long_url
        except ShortenerServiceError, e:
            print e
        sys.exit(0)

예제 #4
0
            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
        except ShortenerServiceError, e:
            print e
        sys.exit(0)

    # Expand a short url.
    if options.short_url:
        try:
            long_url = service.expand_url(options.short_url)
            print long_url
        except ShortenerServiceError, e:
            print e
        sys.exit(0)