File tree Expand file tree Collapse file tree 2 files changed +412
-418
lines changed Expand file tree Collapse file tree 2 files changed +412
-418
lines changed Original file line number Diff line number Diff line change @@ -14,25 +14,22 @@ def shrink(self, bigurl):
14
14
raise ShortyError (url )
15
15
16
16
def expand (self , tinyurl ):
17
- Service .expand (self , tinyurl )
18
-
19
- # needs fixing
20
- """turl = urlparse(tinyurl)
17
+ turl = urlparse (tinyurl )
21
18
if turl [1 ].lstrip ('www.' ) != 'chilp.it' :
22
19
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 : ])
24
21
url = resp .read ()
25
22
if url .startswith ('http://' ):
26
23
return url .strip ('\n \r ' )
27
24
else :
28
- raise ShortyError(url)"""
25
+ raise ShortyError (url )
29
26
30
27
# get click stats of the tinyurl
31
28
def stats (self , tinyurl ):
32
29
turl = urlparse (tinyurl )
33
30
if turl [1 ].lstrip ('www.' ) != 'chilp.it' :
34
31
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 : ])
36
33
hit_count = resp .read ()
37
34
try :
38
35
return int (hit_count )
You can’t perform that action at this time.
0 commit comments