from flask import Flask, redirect, request

flask_app = Flask(__name__)

@flask_app.before_request
def before_request():
    # redirects http requests to https
    if not request.is_secure:
        url = request.url.replace('http://', 'https://', 1)
        code = 301
        return redirect(url, code=code)
e659216cc01c3783e44a57eee25943bed0c84931
<mask token>

<mask token>


@flask_app.before_request
def before_request():
    if not request.is_secure:
        url = request.url.replace('http://', 'https://', 1)
        code = 301
        return redirect(url, code=code)

<mask token>
flask_app = Flask(__name__)


@flask_app.before_request
def before_request():
    if not request.is_secure:
        url = request.url.replace('http://', 'https://', 1)
        code = 301
        return redirect(url, code=code)

from flask import Flask, redirect, request
flask_app = Flask(__name__)


@flask_app.before_request
def before_request():
    if not request.is_secure:
        url = request.url.replace('http://', 'https://', 1)
        code = 301
        return redirect(url, code=code)

from flask import Flask, redirect, request

flask_app = Flask(__name__)

@flask_app.before_request
def before_request():
    # redirects http requests to https
    if not request.is_secure:
        url = request.url.replace('http://', 'https://', 1)
        code = 301
        return redirect(url, code=code)