Skip to content

Commit 1e41c00

Browse files
committed
Implemented tinyurl, is.gd, and cli.gs expand methods using get_redirect()
1 parent 07cced4 commit 1e41c00

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

README

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ Access many URL shortening services from one library.
1010

1111
Supported URL shortening services:
1212
sandbox (stored locally in memory for testing)
13-
tinyurl.com (shrink only)
13+
tinyurl.com
1414
tr.im
1515
urlborg.com
1616
bit.ly
17-
is.gd (shrink only)
17+
is.gd
1818
cli.gs
1919

2020
Language: Python

shorty.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ def shrink(self, bigurl):
147147
resp = request('http://tinyurl.com/api-create.php', {'url': bigurl})
148148
return resp.read()
149149

150+
def expand(self, tinyurl):
151+
return get_redirect(tinyurl)
152+
150153
tinyurl = Tinyurl()
151154

152155
# tr.im
@@ -283,6 +286,9 @@ def shrink(self, bigurl):
283286
raise ShortyError(turl)
284287
return turl
285288

289+
def expand(self, tinyurl):
290+
return get_redirect(tinyurl)
291+
286292
isgd = Isgd()
287293

288294
# cli.gs
@@ -305,8 +311,9 @@ def shrink(self, bigurl, title=None):
305311

306312
def expand(self, tinyurl):
307313
# TODO: debug this some more, not working properly
308-
resp = request('http://cli.gs/api/v1/cligs/expand', {'clig': tinyurl})
309-
return resp.read()
314+
'''resp = request('http://cli.gs/api/v1/cligs/expand', {'clig': tinyurl})
315+
return resp.read()'''
316+
return get_redirect(tinyurl)
310317

311318
cligs = Cligs()
312319

0 commit comments

Comments
 (0)