Skip to content

Commit 773efa8

Browse files
committed
Chilpit issues on expand and stats fixed
1 parent 71f77cc commit 773efa8

File tree

2 files changed

+412
-418
lines changed

2 files changed

+412
-418
lines changed

services/chilpit.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,22 @@ def shrink(self, bigurl):
1414
raise ShortyError(url)
1515

1616
def expand(self, tinyurl):
17-
Service.expand(self, tinyurl)
18-
19-
# needs fixing
20-
"""turl = urlparse(tinyurl)
17+
turl = urlparse(tinyurl)
2118
if turl[1].lstrip('www.') != 'chilp.it':
2219
raise ShortyError('Not a chilp.it url')
23-
resp = request('http://p.chilp.it/api.php?' + turl[4])
20+
resp = request('http://p.chilp.it/api.php?' + turl[2][1:])
2421
url = resp.read()
2522
if url.startswith('http://'):
2623
return url.strip('\n\r')
2724
else:
28-
raise ShortyError(url)"""
25+
raise ShortyError(url)
2926

3027
# get click stats of the tinyurl
3128
def stats(self, tinyurl):
3229
turl = urlparse(tinyurl)
3330
if turl[1].lstrip('www.') != 'chilp.it':
3431
raise ShortyError('Not a chilp.it url')
35-
resp = request('http://s.chilp.it/api.php?' + turl[4])
32+
resp = request('http://s.chilp.it/api.php?' + turl[2][1:])
3633
hit_count = resp.read()
3734
try:
3835
return int(hit_count)

0 commit comments

Comments
 (0)