changeset 28:569a8f40bb6b

Updating
author Walter Cruz <walter@waltercruz.com>
date Wed, 19 Aug 2009 15:03:07 -0300
parents 2b39038f25b7
children 606307f5bfa1
files feed2twitter/feed2twitter/tinyurl.py
diffstat 1 files changed, 3 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/feed2twitter/feed2twitter/tinyurl.py	Mon Jan 05 14:46:20 2009 -0200
+++ b/feed2twitter/feed2twitter/tinyurl.py	Wed Aug 19 15:03:07 2009 -0300
@@ -18,16 +18,9 @@
 
 def tiny(url):
     try:
-        data = urllib.urlencode(dict(url=url, source="RSS2Twit"))
-        encodedurl="http://www.tinyurl.com/api-create.php?"+data
-        instream=urllib.urlopen(encodedurl)
-        ret=instream.read()
-        instream.close()
-
-        if len(ret)==0:
-            return url
-
-        return ret
+        params = urllib.urlencode({'url':url})
+        fp = urllib.urlopen("http://tinyurl.com/api-create.php", params)
+        return fp.read()
 
     except IOError, e:
       raise "urllib error."