facebook.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:noobotkit 作者: nazroll 项目源码 文件源码
def send_attachment_message(sender, attachment_type, payload):
    fb_sender_id = sender['id']
    content = {
        'recipient': {
            'id': fb_sender_id
        },
        'message': {
            'attachment': {
                'type': attachment_type,
                'payload': payload
            }
        }
    }
    headers = {
        'Content-Type': 'application/json'
    }
    payload = json.dumps(content)
    logging.debug(payload)
    url = 'https://graph.facebook.com/v2.6/me/messages?access_token=' + config.FACEBOOK_PAGE_ACCESS_TOKEN
    if config.PRODUCTION:
        req = urlfetch.fetch(
            url,
            payload,
            urlfetch.POST,
            headers
        )
        logging.debug(req.content)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号