【发布时间】:2017-08-25 13:28:08
【问题描述】:
我使用 python 从 Facebook GraphAPI 中提取了一些数据并将其保存到一个变量中。 API 返回 JSON,它在 Python 中保存为嵌套字典。这就是来自 API 的数据在浏览器中的样子。
我希望 mongoDB 以 FB API 返回的合理 JSON 格式存储数据。这可能吗?
代码:
import facebook
graph = facebook.GraphAPI(access_token='my_token', version='2.7')
post = graph.get_object(id='me/friends', fields='feed{message,story,story_tags,created_time,id,message_tags},posts{message,story,story_tags,message_tags,created_time,id},name')
print(post)
请帮忙。
【问题讨论】:
标签: python mongodb python-2.7 pymongo