twitools/googletools/__init__.py

9 lines
267 B
Python
Raw Normal View History

2017-03-13 19:13:58 +00:00
import setuptools, pyshorteners
def shortURL(url):
try:
2017-03-13 21:45:10 +00:00
return pyshorteners.Shortener('Google', api_key=setuptools.getSetting("Google", "googl")).short(url)
except pyshorteners.exceptions.ShorteningErrorException as e:
print("Error handling %s" % url)
raise