We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parent2b6507e commit2aa187eCopy full SHA for 2aa187e
services/bitly.py
@@ -59,6 +59,17 @@ def expand(self, tinyurl):
59
raiseShortyError(jdata['errorMessage'])
60
returnstr(jdata['results'].values()[0]['longUrl'])
61
62
+defstats(self,tinyurl):
63
+ifnotself.login:
64
+returnget_redirect(tinyurl)
65
+parameters,username_pass=self._setup()
66
+parameters['shortUrl']=tinyurl
67
+resp=request('http://api.bit.ly/v3/clicks',parameters,username_pass)
68
+jdata=json.loads(resp.read())
69
+ifjdata['status_code']!=200:
70
+raiseShortyError(jdata['errorMessage'])
71
+returnstr(jdata['data']['clicks'][0]['global_clicks'])
72
+
73
defqrcode(self,tinyurl):
74
qrdata=request(tinyurl+'.qrcode').read()
75
returnqrdata