events.py 文件源码

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

项目:pyucwa 作者: tonybaloney 项目源码 文件源码
def process_message_event(message, resource, token, config):
    logging.debug('Processing message event')
    try:
        if str(message['_embedded']['message']['direction']) == 'Incoming':
            message_uri = message['_embedded']['message']['_links']['plainMessage']['href']
            logging.debug("Received raw message - %s" % message_uri)

            inbound_message = urllib.unquote_plus(DataURI(message_uri).data)
            logging.info("Received message - %s" % inbound_message)

            thread_uri = message['_embedded']['message']['_links']['messaging']['href']

            if MESSAGE_CALLBACK is not None:
                MESSAGE_CALLBACK(inbound_message, thread_uri, resource)
            # send_message(resource + thread_uri + '/messages', 'I found 4 matching incidents https://it12321.servicenow.com/search?query={0}'.format(inbound_message), token, config['redirect_uri'])
    except KeyError:
        logging.debug('not an inbound message')
    pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号