skip to navigation
skip to content

Not Logged In

pyshorteners 0.2.4

A simple URL shortening Python Lib, implementing the most famous shorteners.

Latest Version: 0.2.10

Build Status
Coverage

Description

A simple URL shortening Python Lib, implementing the most famous shorteners.

Usage

Create a Shortener instance passing the engine as an argument. Google Shortener is the default engine if no engine param is passed.

Googl Shortener

No login or api key needed on kwargs

from pyshorteners import Shortener

url = 'http://www.google.com'
shortener = Shortener('GoogleShortener')
print "My short url is {}".format(shortener.short(url))

# expanding
url = 'http://goo.gl/SsadY'
print "My long url is {}".format(shortener.expand(url))

Bit.ly

API Key and login configs needed on kwargs

from pyshorteners import Shortener

# For Bit.ly you HAVE to provide the login and api key
login = 'MY_LOGIN'
api_key = 'MY_API_KEY'

url = 'http://www.google.com'
shortener = Shortener('BitlyShortener', bitly_login=login, bitly_api_key=api_key)
print "My short url is {}".format(shortener.short(url))

# expanding
url = 'http://bit.ly/AvGsb'
print "My long url is {}".format(shortener.expand(url))

TinyURL Shortener

No login or api key needed

from pyshorteners import Shortener

url = 'http://www.google.com'
shortener = Shortener('TinyurlShortener')
print "My short url is {}".format(shortener.short(url))

# expanding
url = 'http://tinyurl.com/ycus76'
print "My long url is {}".format(shortener.expand(url))

Adf.ly Shortener

uid and api key needed, banner type optional (int or banner) No expanding for this shortener

from pyshorteners import Shortener

url = 'http://www.google.com'
shortener = Shortener('AdflyShortener')
print "My short url is {}".format(shortener.short(url, uid=UID,
                                  api_key=API_KEY, type='int'))
 
File Type Py Version Uploaded on Size
pyshorteners-0.2.4.tar.gz (md5) Source 2013-11-06 3KB
  • Downloads (All Versions):
  • 15 downloads in the last day
  • 242 downloads in the last week
  • 982 downloads in the last month