Permalink
Browse files

updated v3/search

  • Loading branch information...
1 parent b40c50a commit fcfc9c7d13e947df61f2cf5b63b65ca4ca496a42 Hilary Mason committed Jan 4, 2013
Showing with 13 additions and 3 deletions.
  1. +13 −3 bitly_api/bitly_api.py
View
@@ -586,10 +586,20 @@ def link_language(self, 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)
+ params = dict(query=query, lang=lang)
+ if offset:
+ assert isinstance(offset, int)
+ params["offset"] = str(offset)
+ if cities: # TODO: check format
+ assert isinstance(cities, str)
+ params["cities"] = cities
+ if domain:
+ assert isinstance(domain, str)
+ params["domain"] = domain
+ if fields:
+ assert isinstance(fields, str)
+ params["fields"] = fields
data = self._call_oauth2_metrics("v3/search", params, limit=limit)
return data['results']

0 comments on commit fcfc9c7

Please sign in to comment.