0

我有来自的代码片段

https://github.com/litl/rauth/blob/master/examples/facebook/facebook.py

def authorized():
    # check to make sure the user authorized the request
    if not 'code' in request.args:
        flash('You did not authorize the request')
        return redirect(url_for('index'))

    # make a request for the access token credentials using code
    redirect_uri = url_for('authorized', _external=True)
    data = dict(code=request.args['code'], redirect_uri=redirect_uri)

    session = facebook.get_auth_session(data=data)

    # the "me" response
    me = session.get('me').json()

    User.get_or_create(me['username'], me['id'])

#print(me['first_name'])
#flash('Logged in as ' + me['name'])
    flash('Logged in as ' + me['name'])
    for key, value in me.iteritems():
    print key, value
    return redirect(url_for('index'))

主要问题是哈希“我”不包含任何与好友列表对应的键。但是在图形资源管理器中

https://developers.facebook.com/tools/explorer/?method=GET&path=xxxxxxxfields%3Dfriendlists

我可以在单击“+”号时弹出的列表中获取好友列表,通过单击提交我可以获得好友列表。因此,如何使用 rauth API 获取好友列表?

谢谢

4

1 回答 1

0

嗯,我明白了,这是:

friends = session.get('<id>/friends').json();
于 2013-06-25T05:47:35.323 回答