如何使用Python请求和Graph API在Facebook上发布图像?

2024-04-23 18:11:52 发布

您现在位置:Python中文网/ 问答频道 /正文

1)我需要一个功能,应该发布与给定的消息和照片后。 可以使用中提供的页面ID和访问令牌self.page\u标识以及self.page\u访问\u令牌你知道吗

def __init__(self):
        self.page_id = Facebook.get_access_token('FACEBOOK_PAGE_ID')
        self.page_access_token = Facebook.get_access_token('FACEBOOK_PAGE_ACCESS_TOKEN')

2)要找到要命中的API,请查看Facebook API的developer部分:https://developers.facebook.com/docs/graph-api/reference/page/photos/#example-2

3)函数不应返回任何内容。你知道吗

def publish_photo_msg(self, message, image_url):
#your code here
return

请帮忙。你知道吗


Tags: self功能tokenapiid消息getfacebook