简体   繁体   English

Facebook Graph API python facepy

[英]Facebook Graph API python facepy

I'm using facepy for retrieving fb comments and posts (This is the objective). 我正在使用facepy检索fb评论和帖子(这是目标)。 I've given a valid access token (generated from http://developers.facebook.com/tools/explorer/?method=GET&path=me ) 我给了一个有效的访问令牌(从http://developers.facebook.com/tools/explorer/?method=GET&path=me生成)

The error generated is: 生成的错误是:

NameError: name 'AAACEdEose0cBAHshwZCGJ6dHPb0x68c.......D' is not defined. NameError:名称“ AAACEdEose0cBAHshwZCGJ6dHPb0x68c ....... D”未定义。 And/OR facepy.exceptions.OAuthError: [190] Error validating access token: Session has expired at unix time 1359752400. 和/或facepy.exceptions.OAuthError:[190]验证访问令牌时出错:会话在unix时间1359752400过期。

I believe I've generated the correct access token (with the correct permissions) I thought I would test the facepy library for retrieving photos first. 我相信我已经生成了正确的访问令牌(具有正确的权限),我认为我会先测试facepy库以获取照片。 Is their a faster way to retrieve comments, respective user ids, and time stamp from a public fan page (I am guessing most of my target pages have 'public information') 是他们从公共粉丝页面中检索评论,相应的用户ID和时间戳的更快方法(我猜我的大多数目标页面都有“公共信息”)

Can someone help me on this? 有人可以帮我吗?

from facepy import GraphAPI

graph = GraphAPI(AAACEdEose0cBAHshwZCGJ6dHPb0x68c.......D)

graph.get('me/posts')

graph.post(
    path = 'me/photos',
    source = open('parrot.jpg')

Never tried with the FB but some of the solutions which worked with other API's. 从未尝试使用FB,而是尝试了一些可与其他API一起使用的解决方案。

Error validating access token: Session has expired at unix time 1359752400. 验证访问令牌时出错:会话在unix时间1359752400过期。

Says All. 全部说。 However mostly occurs when I did connected it to some DB for storing some information retrieved from the API.I am sure you have made a right key and password so don't worry about it. 但是大多数情况是在我将其连接到某个数据库以存储一些从API检索到的信息时发生的。我确定您已经输入了正确的密钥和密码,所以不必担心。 Make sure the other connection is still open. 确保另一个连接仍然打开。

Second, it happened again when I did not accessed the API for weeks so make sure to log in once or twice. 其次,当我数周没有访问API时,它再次发生,因此请确保登录一次或两次。

您的API需要加引号...还可以通过以下命令生成扩展令牌

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM