====== 09 Flask ======
FlaskでProxyサーバ
from flask import request
from flask import Flask
import urllib.request
import urllib.parse
app = Flask(__name__)
@app.route('/')
def hello():
return "Hello World"
@app.route('/good')
def good():
return "Good"
# start
if __name__ == "__main__":
app.run(host='0.0.0.0')
===== Flask 並列処理 =====
[[https://qiita.com/5zm/items/251be97d2800bf67b1c6]]
===== Flask ロギング =====
from flask import request
import logging
logging.basicConfig(level=logging.INFO)
werkzeug_logger = logging.getLogger("werkzeug")
@app.route('/', methods=['POST', 'GET'])
def hello():
params = {
'url' : request.form['url']
, 'hoge1' : request.form['hoge1']
, 'hoge2' : request.form['hoge2']
, 'hoge3' : request.form['hoge3']
}
werkzeug_logger.info(params)
{{tag>Python}}