在Python Facebook SDK中请求字段 [英] Request fields in Python Facebook SDK
本文介绍了在Python Facebook SDK中请求字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我正在获取 / me
对象的方式:
This is the way I am currently fetching the /me
object:
self.facebook_user = facebook.GraphAPI(access_token).get_object('me')
但是,如果我想要,来自 / me
的名称
和 id
我建立请求?
But if I want, for example, to request only the name
and id
fields from /me
, how do I build the request?
推荐答案
您可以使用** args传递额外的查询参数:
You can pass in extra query parameters using **args:
graph = facebook.GraphAPI(access_token)
profile = graph.get_object('me')
args = {'fields' : 'id,name,email', }
profile = graph.get_object('me', **args)
这篇关于在Python Facebook SDK中请求字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文