Skip to content

Commit 5ffd6d4

Browse files
committed
update requirements + shed
1 parent 320fb5e commit 5ffd6d4

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

app.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
import sys
44
import time
55

6-
from flask import Flask, json, request, abort
6+
from flask import Flask, abort, json, request
77
from markupsafe import escape
88
from redis import Redis, RedisError
9+
910
from fix_proxy import add_wsgi_proxy
1011

1112
# Connect to Redis
@@ -18,7 +19,7 @@
1819

1920
@app.route("/")
2021
def hello(more=""):
21-
info = json.dumps(request.environ, indent=2, default=lambda o: repr(o))
22+
info = json.dumps(request.environ, indent=2, default=repr)
2223
try:
2324
visits = redis.incr("counter")
2425
except RedisError:

app_test.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
23
import pytest
34

45

fix_proxy.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
23
from werkzeug.middleware.proxy_fix import ProxyFix
34

45
# See https://werkzeug.palletsprojects.com/en/2.0.x/middleware/proxy_fix/
@@ -11,6 +12,7 @@
1112
# You must tell the middleware how many proxies set each header so it knows what values to trust.
1213
# app = ProxyFix(app, x_for=1, x_proto=1, x_host=0, x_port=0, x_prefix=0)
1314

15+
1416
# Wrapping app.wsgi_app instead of app means that app still points at your Flask application, not at the middleware.
1517
def add_wsgi_proxy(wsgi_app):
1618
if not os.getenv("PROXY_FIX", 0):

0 commit comments

Comments
 (0)