先决条件
email
email
工作正常access token
用户目标
问题
name
和id
,但未包含email
email
在一起码
import facebook
graph = facebook.GraphAPI(access_token='CAA...DZD')
graph.get_object(id='me')
# result : {u'name': u'Username', u'id': u'123456789'}
graph.get_object(id='me?fields=email,id,name')
# Error : facebook.GraphAPIError: An active access token must be used to query information about the current user
答案 0 :(得分:11)
您可以尝试以下代码:
graph = facebook.GraphAPI(access_token)
profile = graph.get_object('me')
args = {'fields' : 'id,name,email', }
profile = graph.get_object('me', **args)