Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install bitlyapi

How to install bitlyapi

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install bitlyapi
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.1.1 Available View build log
Windows (64-bit)
0.1.1 Available View build log
Mac OS X (10.5+)
0.1.1 Available View build log
Linux (32-bit)
0.1.1 Available View build log
Linux (64-bit)
0.1.1 Available View build log
 
License
BSD
Dependencies
Imports
Lastest release
version 0.1.1 on Jan 5th, 2011

Python bit.ly wrapper

This is a thin Python wrapper for the bit.ly API. Basic usage looks like this:

>>> import bitlyapi
>>> b = bitlyapi.BitLy(api_user, api_key)
>>> res = b.shorten(longUrl='http://www.google.com/')
>>> print res['url']

System Message: ERROR/3 (<string>, line 12)

Inconsistent literal block quoting.

'http://bit.ly/6Hwstb' >>> print res['long_url'] 'http://www.google.com/'

The return from any method call is a dict containing the results of decoding the JSON returned from bit.ly. For example:

>>> import pprint
>>> pprint.pprint(res)

System Message: ERROR/3 (<string>, line 21)

Inconsistent literal block quoting.

{'global_hash': '2V6CFi', 'hash': '9gOd4I', 'long_url': 'http://www.google.com/', 'new_hash': 1, 'url': 'http://bit.ly/9gOd4I'}

You can supply arbitrary keywords to method calls and they will be passed to the bit.ly API:

>>> res = api.shorten(domain="j.mp", longUrl="http://www.example.com/foobar.html")
>>> pprint.pprint(res)

System Message: ERROR/3 (<string>, line 32)

Inconsistent literal block quoting.

{'global_hash': 'cITxl0', 'hash': 'cY4460', 'long_url': 'http://www.example.com/foobar.html', 'new_hash': 1, 'url': 'http://j.mp/cY4460'}

Changelog

0.1.1 (2010-04-07)
  • fixed path to README and CHANGES in setup.py and add MANIFEST.in
0.1 (2010-04-07)
  • initial release

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.