Skip to content

Commit afb5026

Browse files
committed
Small change to short.to service. Implemented to.ly service.
1 parent d8410ec commit afb5026

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed

services/shortto.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,5 @@ def shrink(self, bigurl):
1111

1212
def expand(self, tinyurl):
1313
resp = request('http://long.to/do.txt', {'url': tinyurl})
14-
url = resp.read()
15-
if url.startswith('http'):
16-
return url
17-
else:
18-
raise ShortyError(url)
14+
return resp.read()
1915

services/toly.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Shorty
2+
## Copyright 2009 Joshua Roesslein
3+
## See LICENSE
4+
5+
## @url to.ly
6+
class Toly(Service):
7+
8+
def shrink(self, bigurl):
9+
resp = request('http://to.ly/api.php', {'longurl': bigurl})
10+
return resp.read()
11+

shorty.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,14 @@ def expand(self, tinyurl):
286286

287287
cligs = Cligs()
288288

289+
# toly
290+
class Toly(Service):
291+
292+
def shrink(self, bigurl):
293+
resp = request('http://to.ly/api.php', {'longurl': bigurl})
294+
return resp.read()
295+
toly = Toly()
296+
289297
# fongs
290298
class Fongs(Service):
291299

@@ -471,11 +479,7 @@ def shrink(self, bigurl):
471479

472480
def expand(self, tinyurl):
473481
resp = request('http://long.to/do.txt', {'url': tinyurl})
474-
url = resp.read()
475-
if url.startswith('http'):
476-
return url
477-
else:
478-
raise ShortyError(url)
482+
return resp.read()
479483

480484
shortto = Shortto()
481485

@@ -633,9 +637,9 @@ def expand(self, tinyurl):
633637
'chilp.it': chilpit,
634638
'digg.com': digg,
635639
'tweetburner.com': tweetburner,
636-
'buk.me': bukme,
637-
'twurl.nl': tweetburner,
638640
'tr.im': trim,
641+
'twurl.nl': tweetburner,
642+
'to.ly': toly,
639643
'cli.gs': cligs,
640644
'urlborg.com': urlborg,
641645
'is.gd': isgd,
@@ -646,5 +650,6 @@ def expand(self, tinyurl):
646650
'fwd4.me': fwd4me,
647651
'short.ie': shortie,
648652
'sandbox.com': sandbox,
653+
'buk.me': bukme,
649654
}
650655

0 commit comments

Comments
 (0)