Skip to content

Commit 4e7101e

Browse files
committed
fixes an error when trying to get followers.
I think this happened because data is not an array but json, and the users array i inside the users key.
1 parent 9f95204 commit 4e7101e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

twitter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3045,7 +3045,7 @@ def GetFollowers(self, user=None, cursor=-1):
30453045
if not self._oauth_consumer:
30463046
raise TwitterError("twitter.Api instance must be authenticated")
30473047
if user:
3048-
url = '%s/statuses/followers/%s.json' % (self.base_url, user)
3048+
url = '%s/statuses/followers/%s.json' % (self.base_url, user.GetId())
30493049
else:
30503050
url = '%s/statuses/followers.json' % self.base_url
30513051
result = []
@@ -3054,7 +3054,7 @@ def GetFollowers(self, user=None, cursor=-1):
30543054
parameters = { 'cursor': cursor }
30553055
json = self._FetchUrl(url, parameters=parameters)
30563056
data = self._ParseAndCheckTwitter(json)
3057-
result += [User.NewFromJsonDict(x) for x in data]
3057+
result += [User.NewFromJsonDict(x) for x in data['users']]
30583058
if 'next_cursor' in data:
30593059
if data['next_cursor'] == 0 or data['next_cursor'] == data['previous_cursor']:
30603060
break

0 commit comments

Comments
 (0)