Add URL shortening method in googletools
This commit is contained in:
parent
ee9c3426ff
commit
294f9f08d1
1 changed files with 8 additions and 0 deletions
8
googletools/__init__.py
Normal file
8
googletools/__init__.py
Normal file
|
@ -0,0 +1,8 @@
|
|||
import pyshorteners
|
||||
|
||||
def shortURL(url):
|
||||
try:
|
||||
pyshorteners.Shortener('Google', api_key=setuptools.getSetting("Google", "googl")).short(url)
|
||||
except pyshorteners.exceptions.ShorteningErrorException as e:
|
||||
print("Error handling %s" % url)
|
||||
raise
|
Loading…
Reference in a new issue