Skip to content
Browse files

Merge pull request #2 from bde/master

Implemented Data APIs
  • Loading branch information...
2 parents 37334c3 + 56a54b4 commit e1235f5cd5d6616aca6da509d06e818d5f16bd38 @hmason hmason committed Dec 21, 2012
Showing with 55 additions and 1 deletion.
  1. +55 −1 bitly_api/bitly_api.py
View
56 bitly_api/bitly_api.py
@@ -330,6 +330,61 @@ def pro_domain(self, domain):
data = self._call(self.host, end_point, params, self.secret)
return data['data']['bitly_pro_domain']
+ def highvalue(self, limit=10, lang='en'):
+ params = dict(lang=lang)
+ data = self._call_oauth2_metrics("v3/highvalue", params, limit=limit)
+ return data
+
+ def realtime_bursting_phrases(self):
+ data = self._call_oauth2_metrics("v3/realtime/bursting_phrases", dict())
+ return data["phrases"]
+
+ def realtime_hot_phrases(self):
+ data = self._call_oauth2_metrics("v3/realtime/hot_phrases", dict())
+ return data["phrases"]
+
+ def realtime_clickrate(self, phrase):
+ params = dict(phrase=phrase)
+ data = self._call_oauth2_metrics("v3/realtime/clickrate", params)
+ return data["rate"]
+
+ def link_info(self, link):
+ params = dict(link=link)
+ data = self._call_oauth2_metrics("v3/link/info", params)
+ return data
+
+ def link_content(self, link, content_type="html"):
+ params = dict(link=link, content_type=content_type)
+ data = self._call_oauth2_metrics("v3/link/content", params)
+ return data["content"]
+
+ def link_category(self, link):
+ params = dict(link=link)
+ data = self._call_oauth2_metrics("v3/link/category", params)
+ return data["categories"]
+
+ def link_social(self, link):
+ params = dict(link=link)
+ data = self._call_oauth2_metrics("v3/link/social", params)
+ return data["social_scores"]
+
+ def link_location(self, link):
+ params = dict(link=link)
+ data = self._call_oauth2_metrics("v3/link/location", params)
+ return data["locations"]
+
+ def link_language(self, link):
+ params = dict(link=link)
+ data = self._call_oauth2_metrics("v3/link/language", params)
+ return data["languages"]
+
+ #TODO - Incomplete
+ def search(self, query, offset=None, cities=None, domain=None, fields=None, limit=10, lang='en'):
+ params = dict(query=query, offset=offset, cities=cities, domain=domain,
+ fields=fields, lang=lang)
+ data = self._call_oauth2_metrics("v3/search", params, limit=limit)
+ return data['results']
+
@classmethod
def _generateSignature(self, params, secret):
if not params or not secret:
@@ -425,4 +480,3 @@ def _call(self, host, method, params, secret=None, timeout=5000):
raise
except Exception:
raise BitlyError(None, sys.exc_info()[1])
-

0 comments on commit e1235f5

Please sign in to comment.
Something went wrong with that request. Please try again.