Permalink
Browse files

Add info() method to retrieve page titles.

  • Loading branch information...
jeffmiller authored and jehiah committed Nov 16, 2010
1 parent 31d8395 commit 010bee615eb1e5294f741106f5055b04c2e0e741
Showing with 16 additions and 0 deletions.
  1. +16 −0 bitly_api/bitly_api.py
View
@@ -139,6 +139,22 @@ def clicks_by_minute(self, hash=None, shortUrl=None):
data = self._call(self.host, 'v3/clicks_by_minute', params, self.secret)
return data['data']['clicks_by_minute']
+
+ def info(self, hash=None, shortUrl=None):
+ """ return the page title for a given bit.ly link """
+ if not hash and not shortUrl:
+ raise BitlyError(500, 'MISSING_ARG_SHORTURL')
+ params = {
+ 'login' : self.login,
+ 'apiKey' : self.api_key
+ }
+ if hash:
+ params['hash'] = hash
+ if shortUrl:
+ params['shortUrl'] = shortUrl
+
+ data = self._call(self.host, 'v3/info', params, self.secret)
+ return data['data']['info']
def lookup(self, url):
""" query for a bit.ly link based on a long url """

0 comments on commit 010bee6

Please sign in to comment.