def post_to_facebook(message, link=None):
"""Posts a message to the Facebook page using GraphAPI authenticated via
`FACEBOOK_PAGE_ACCESS_TOKEN`.
Args:
- message: str. The content of the message to be posted on Facebook.
- link: str. (Optional) Url of the attachment to be posted along
with message.
Returns:
- None
"""
graph = GraphAPI(access_token=FACEBOOK_PAGE_ACCESS_TOKEN)
attachment = {
'link': link, # link to visit on clicking on the attachment.
'picture': link # link of the attachment to be posted.
}
graph.put_wall_post(message=message, attachment=attachment)
评论列表
文章目录