Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Added qrcode service in bit.ly and goo.gl#5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
joshthecoder merged 3 commits intojoshthecoder:masterfromastagi:qrcodes
Aug 3, 2011
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletionsservices/bitly.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -59,3 +59,21 @@ def expand(self, tinyurl):
raise ShortyError(jdata['errorMessage'])
return str(jdata['results'].values()[0]['longUrl'])

def stats(self, tinyurl):
if not self.login:
return get_redirect(tinyurl)
parameters, username_pass = self._setup()
parameters['shortUrl'] = tinyurl
resp = request('http://api.bit.ly/v3/clicks', parameters, username_pass)
jdata = json.loads(resp.read())
if jdata['status_code'] != 200:
raise ShortyError(jdata['errorMessage'])
clicks = {}
clicks['user'] = jdata['data']['clicks'][0]['user_clicks']
clicks['global'] = jdata['data']['clicks'][0]['global_clicks']
return clicks

def qrcode(self, tinyurl):
qrdata = request(tinyurl + '.qrcode').read()
return qrdata

4 changes: 4 additions & 0 deletionsservices/google.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,3 +14,7 @@ def shrink(self, bigurl):
else:
return jdata['short_url']

def qrcode(self, tinyurl):
qrdata = request(tinyurl + '.qr').read()
return qrdata


[8]ページ先頭

©2009-2025 Movatter.jp