getting permissions
dco5 opened this issue · 2 comments
is there any reason why it's only grabbing the first permission?
def permissions(self):
"""
A list of strings describing permissions
_ the user has granted your application.
.. _permissions: http://developers.facebook.com/docs/reference/api/permissions/
"""
records = self.graph.get('me/permissions')['data'][0]
permissions = []
for permission, status in records.items():
if status:
permissions.append(permission)
return permissions
I removed the [0] and looped asking if the permission status is granted append to permissions. Maybe there is a reason you only get the first one but I think it should return all of the permissions.
Sorry for not getting around to this sooner, @dco5! You're quite right – it seems that Facebook has changed the format of this endpoint from a dictionary to an array. According to our tests, it used to be {one_permission: true, another_permission: false}
whereas now it is [{status: 'granted', permission: 'one_permission'}, {status: 'declined', permission: 'another_permission']
.
I've changed the code and tests accordingly in 70d1b74, so it should work as intended now. Thanks!
This made it into v4.2.1!