Reputation: 1811
I am trying to just know how many friends a user has. This is what I tried, but it doesn't work:
>>> import facebook
>>> graph = facebook.GraphAPI("CAAEr.....XCODEe6bMZD")
>>> profile = graph.get_object('puja41')
>>> friends = graph.get_connections("puja41", "friends")
Traceback (most recent call last):
File "<pyshell#54>", line 1, in <module>
friends = graph.get_connections("puja41", "friends")
File "C:/Documents and Settings/visolank/Desktop/Python/programs\facebook.py", line 112, in get_connections
return self.request(id + "/" + connection_name, args)
File "C:/Documents and Settings/visolank/Desktop/Python/programs\facebook.py", line 298, in request
raise GraphAPIError(response)
GraphAPIError: Unsupported operation
When i tried JonasR's suggestion, I got:
{
"error": {
"message": "Unsupported operation",
"type": "FacebookApiException",
"code": 100
}
}
Upvotes: 0
Views: 1035
Reputation: 8013
This is because your application has not requested (or not had the user grant) access to that user's friends connection. I can view that user's basic details in the GraphAPI Explorer, but if I try to view the "friends" connection, I get "Unsupported operation"
as a response message.
Upvotes: 2
Reputation: 1
I suggest your acces token is wrong. Try this URL with your acces token inserted on your browser https://graph.facebook.com/puja41/friends?access_token=YOURTOKENHERE
Upvotes: 0