Mercurial > feed2twitter
view feed2twitter/feed2twitter/tinyurl.py @ 28:569a8f40bb6b
Updating
author | Walter Cruz <walter@waltercruz.com> |
---|---|
date | Wed, 19 Aug 2009 15:03:07 -0300 |
parents | ba17f1f62e8f |
children |
line wrap: on
line source
# feed2twitter # Copyright (C) 2008 Walter Cruz <walter@waltercruz.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import urllib def tiny(url): try: params = urllib.urlencode({'url':url}) fp = urllib.urlopen("http://tinyurl.com/api-create.php", params) return fp.read() except IOError, e: raise "urllib error."