HTTP environment variables in Flask

I don't know if the term HTTP environment variable is correct.

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

HTTP environment variables in Flask
How to access environment variables in Python
To reference environment variables in Python in Blender
Shell variables, environment variables
Super easy! Python + Flask environment in Docker quickly
Use pydantic when reading environment variables in Python
Use os.getenv to get environment variables in Python
Http request in python
What are environment variables?
virtualenvwrapper in windows environment
virtual environment in python
Development environment in Python
Image uploader in Flask
Get environment variables in Python, otherwise set default values
How to pass matplotlib backend settings in environment variables
Environment variables when using Tkinter
Flask unit test environment (test_client)
Handle Go environment variables (viper)
Use Anaconda in pyenv environment
SSH restrictions in Linux environment
What are environment variables? (Linux)
Use HTTP cache in Python
Collaborate in a remote environment
Pip install in proxy environment
Byobu crashes in pyenv environment
(Note) Django in Vagrant environment
Simply check Content-Type in Flask (@content_type)
Celery asynchronous processing in Flask
Flow in which malloc parameters are set from environment variables
Set environment variables with lambda-uploader
Upload multiple files in Flask
How to debug Dash (Flask) in Docker + VSCode + remote connection environment
Use <input type = "date"> in Flask
Create dummy variables in pandas (get_dummies)
Run eclipse in Docker environment (noVNC)
Landmines hidden in Python class variables
Write an HTTP / 2 server in Python
Fixed Apscheduler running twice in Flask
Timestamp acquisition command in Unix environment
About parameter processing in Flask request.args
Build Flask environment with Dockerfile + docker-compose.yml
install tensorflow in anaconda + python3.5 environment
Using global variables in python functions
Try giving AWS Lambda environment variables?
Hello World in Flask [Appropriate memo]
Use django-debug-toolbar in VirtualBox / Vagrant environment
UnicodeDecodeError occurs in pip (Windows environment)
Configuration file best practices in Flask
Read system environment variables with python-Part 1
Read system environment variables with python-Part 2
Redirect HTTP to HTTPS with Elastic Beanstalk in Go / Java SE environment
How to read environment variables from .env file in PyCharm (on Mac)