How to get GCP region value inside python code

Viewed 37

I have a simple python app that I containerized and deployed that container in 5 regions using google run on GCP. I also have a load balancer.

my code now returns a simple hello world, but I would like to return the name of the region. For example, if I visit the page from us it should show me US region. If I visit from Frankfurt it should show me the Europe region.

there has to be a way to get the value but I can't find one.

from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_ekipa():
    return '<h1>Hello world</h2>'
    


if __name__ == "__main__":
    app.run(debug=True)
0 Answers
Related