Ich weiß nicht, ob der Begriff HTTP-Umgebungsvariable korrekt ist.
app.py
from flask import Flask, request
app = Flask(__name__)
@app.route('/')
def hello_world():
for k in request.environ:
print("{}={}".format(k, request.environ[k]))
return 'Hello World!'
if __name__ == '__main__':
app.run()
SERVER_SOFTWARE=Werkzeug/1.0.1
REQUEST_METHOD=GET
SCRIPT_NAME=
PATH_INFO=/
QUERY_STRING=
REQUEST_URI=/
RAW_URI=/
REMOTE_ADDR=127.0.0.1
REMOTE_PORT=62784
SERVER_NAME=127.0.0.1
SERVER_PORT=5000
SERVER_PROTOCOL=HTTP/1.1
HTTP_HOST=127.0.0.1:5000
HTTP_CONNECTION=keep-alive
HTTP_CACHE_CONTROL=max-age=0
HTTP_UPGRADE_INSECURE_REQUESTS=1
HTTP_USER_AGENT=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36
HTTP_ACCEPT=text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
HTTP_SEC_FETCH_SITE=none
HTTP_SEC_FETCH_MODE=navigate
HTTP_SEC_FETCH_USER=?1
HTTP_SEC_FETCH_DEST=document
HTTP_ACCEPT_ENCODING=gzip, deflate, br
HTTP_ACCEPT_LANGUAGE=ja,en-US;q=0.9,en;q=0.8,und;q=0.7
Recommended Posts