Skip to content
This repository was archived by the owner on Aug 7, 2024. It is now read-only.

Adding api methods for suggestions and suggestions/:slug #254

Merged
merged 7 commits into from
Nov 14, 2015
Prev Previous commit
Next Next commit
Added fix to get user suggestions call so that it called the correct …
…endpoint haha
  • Loading branch information
d2dcrc-wdp committed Nov 9, 2015
commit 954ac8b8e36719a3e0828780b2f82b4b9fc43962
18 changes: 18 additions & 0 deletions twitter/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,24 @@ def GetUserSuggestionCategories(self):
categories.append(Category.NewFromJsonDict(category))
return categories

def GetUserSuggestion(self, category):
""" Returns a list of users in a category
Args:
category:
The Category object to limit the search by
Returns:
A list of users in that category
"""
url = '%s/users/suggestions/%s.json' % (self.base_url, category.Slug)

json_data = self._RequestUrl(url, verb='GET')
data = self._ParseAndCheckTwitter(json_data.content)

users = []
for user in data.users:
users.append(User.NewFromJsonDict(user))
return users

def GetHomeTimeline(self,
count=None,
since_id=None,
Expand Down