user2547755 user2547755 - 1 year ago 120
Python Question

Python facebook-sdk post to page

I'm trying to post to a Facebook Page I manage with the Python facebook-sdk but I can't figure out how to do it. I can post to my Facebook Wall like so:

graph.put_object("me", "feed", message='My message goes here')

I can get the pages I manage and the access tokens like so:

fbpages = graph.request('me/accounts')

But I can't find any resources to indicate how to actually then use the access token to post to the page. I imagine it would be something like this:

graph.put_object("me", "page id", "access token", message='My message goes here')

How would I actually go about doing this with the Python facebook-sdk?

I'm using 'pythonforfacebook/facebook-sdk'.

Answer Source

Thank's to WizKid for pointing me in the right direction. For anyone else with this problem it is solved like so:

graph = facebook.GraphAPI(page_access_token)
graph.put_object("page id", "feed", message='My message goes here')
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download