From 649d6b9793dd8ec70bc529d829ac7e64a033b84a Mon Sep 17 00:00:00 2001 From: Tom Wilkie Date: Wed, 27 May 2015 15:42:57 +0000 Subject: [PATCH] Python requests only does keep alive within a session... --- experimental/example/client/client.py | 3 ++- experimental/example/pyapp/app.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/experimental/example/client/client.py b/experimental/example/client/client.py index f375f404c..a46f66166 100644 --- a/experimental/example/client/client.py +++ b/experimental/example/client/client.py @@ -8,9 +8,10 @@ pyapps = ['http://pyapp:5000/'] concurrency = 5 def do_requests(): + s = requests.Session() while True: try: - requests.get(random.choice(pyapps)) + s.get(random.choice(pyapps)) except: logging.error("Error doing request", exc_info=sys.exc_info()) logging.info("Did request") diff --git a/experimental/example/pyapp/app.py b/experimental/example/pyapp/app.py index 22409b463..7e2791d04 100644 --- a/experimental/example/pyapp/app.py +++ b/experimental/example/pyapp/app.py @@ -42,4 +42,4 @@ def hello(): return result if __name__ == "__main__": - app.run(host="0.0.0.0", debug=True) + app.run(host="0.0.0.0", port=5000, debug=True)