使用pyfacebook更新Facebook页面的状态 [英] Update Facebook Page's status using pyfacebook
问题描述
我已经下载并安装了 pyfacebook - 我已经阅读了教程从Facebook。我也看到这个建议这里是SO :
import facebook
fb = facebook.Facebook('YOUR_API_KEY','YOUR_SECRET_KEY')
fb.auth.createToken )
fb.login()#这是我可以获得
fb.auth.getSession()
fb.set_status('检出StackOverFlow.com')
然而,当我访问 login()
pyfacebook试图打开lynx,所以我可以通过网络登录到Facebook' - 这显然不会为我工作,因为系统应该是自动化的...
我一直在寻找,但是找不到如何保持这一切都可以使用脚本,而不必通过网络浏览器进行登录。
任何想法?
在 login
,特别是在docstring中,似乎打算使用浏览器,以便您以这种方式登录。
def login(self,popup = False):
打开一个Web浏览器,告诉用户登录到Facebook。
import webbrowser
webbrowser.open(self.get_login_url(popup = popup))
您链接的Facebook页面用户:PyFacebook_Tutorial ,它看起来像例如 login
是一个桌面应用程序示例。您要遵循Web应用程序部分。我鼓励你直接按照那里的教程。
I am attempting to add functionality to my Django app: when a new post is approved, I want to update the corresponding Facebook Page's status with a message and a link to the post automatically. Basic status update.
I have downloaded and installed pyfacebook - and I have read through the tutorial from Facebook. I have also seen this suggestion here on SO:
import facebook
fb = facebook.Facebook('YOUR_API_KEY', 'YOUR_SECRET_KEY')
fb.auth.createToken()
fb.login() # THIS IS AS FAR AS I CAN GET
fb.auth.getSession()
fb.set_status('Checking out StackOverFlow.com')
When I get to the login()
call, however, pyfacebook tries to open lynx so I can login to Facebook 'via the web' -- this is, obviously, not going to work for me because the system is supposed to be automated ...
I've been looking, but can't find out how I can keep this all working with the script and not having to login via a web browser.
Any ideas?
In the definition of login
, particularly in the docstring, it appears as though the intended behavior is to open up a browser in order to have you log in that way.
def login(self, popup=False):
"""Open a web browser telling the user to login to Facebook."""
import webbrowser
webbrowser.open(self.get_login_url(popup=popup))
Looking at the facebook page User:PyFacebook_Tutorial that you linked, it looks like the example with login
is a "Desktop Applications" example. You want to follow the "Web Applications" section. I'd encourage you to simply press ahead with the tutorial there.
这篇关于使用pyfacebook更新Facebook页面的状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!