from flask import request
from flask import Flask, jsonify
import logging
import logging.config
import time
logger = logging.getLogger()
logger.setLevel(logging.INFO)
rq = time.strftime('%Y%m%d%H%M', time.localtime(time.time()))
logfile = "logging.log"
#logging.basicConfig(level=logging.DEBUG,
# format='[%(asctime)s] %(levelname)s [%(funcName)s: %(filename)s, %(lineno)d] %(message)s',
# datefmt='%Y-%m-%d %H:%M:%S',
# filemode='a')
fh = logging.FileHandler(logfile, mode='w')
fh.setLevel(logging.DEBUG)
formatter = logging.Formatter("%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s")
fh.setFormatter(formatter)
logger.addHandler(fh)
app = Flask(__name__)
@app.route('/webhook', methods=['POST'])
def webhook_task():
logger.info('body:%s',request.get_data())
return "OK",200
if __name__ == '__main__':
app.run(host="0.0.0.0",debug=True)
参考:
1、https://www.cnblogs.com/vovlie/p/4178077.html
2、https://www.cnblogs.com/CJOKER/p/8295272.html
3、
阅读(1460) | 评论(0) | 转发(0) |