Skip to content

Commit 6129144

Browse files
committed
Complete stats for bit.ly with user and global click
1 parent 2aa187e commit 6129144

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

services/bitly.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ def stats(self, tinyurl):
6868
jdata = json.loads(resp.read())
6969
if jdata['status_code'] != 200:
7070
raise ShortyError(jdata['errorMessage'])
71-
return str(jdata['data']['clicks'][0]['global_clicks'])
71+
clicks = {}
72+
clicks['user'] = jdata['data']['clicks'][0]['user_clicks']
73+
clicks['global'] = jdata['data']['clicks'][0]['global_clicks']
74+
return clicks
7275

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

0 commit comments

Comments
 (0)