I'm using django-socialregistration and facebook python s开发者_如何学编程dk.
This is the code to get friends:
friends = request.facebook.graph.get_connections('me', 'friends')
I can get their name and id but I can't get their email address (not their @facebook.com email).
This is another attempt which also can't get their email.
for friend in friends['data']:
request.facebook.graph.get_object(friend['id'])
How can I get the facebook friends email?
It is possible to get the email of a user connected to your app using Graph. However, when connecting or signing in using Facebook users must explicitly give you permission to use their email address. Since none of the friends gave you permission, their e-mail addresses are off limits. What this means is you can encourage the user to have their friends join as well, and make sure that when they sign up you include a request for their e-mail address.
I think you are not getting the email from friends because this is not even possible to get from Facebook`s Graph API.
Check this out: Facebook Graph API, how to get users email?
精彩评论