From 9fec4e81cc8ddcc76b11caee307fcd77da142879 Mon Sep 17 00:00:00 2001 From: Fabian Date: Fri, 8 May 2020 21:04:13 +0200 Subject: [PATCH] minor --- consumer_api/app.py | 15 +++++++-------- consumer_api/tests/consumers_view_test.py | 1 + consumer_api/views/consumers_view.py | 1 - consumer_api/views/log_view.py | 5 +++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/consumer_api/app.py b/consumer_api/app.py index e2829ac..097178d 100644 --- a/consumer_api/app.py +++ b/consumer_api/app.py @@ -19,14 +19,13 @@ __version__text__ = "1" SENTRY_DSN = os.environ.get("SENTRY_DSN") if SENTRY_DSN: sentry_sdk.init( - dsn=SENTRY_DSN, - integrations=[FlaskIntegration()], - send_default_pii=True, - release=os.environ.get('RELEASE_ID', 'test'), - environment=os.environ.get('RELEASEMODE', 'dev') + dsn = SENTRY_DSN, + integrations = [FlaskIntegration()], + send_default_pii = True, + release = os.environ.get('RELEASE_ID', 'test'), + environment = os.environ.get('RELEASEMODE', 'dev') ) - app = Flask(__name__) app.config['REDIS_URL'] = os.environ['REDIS_URL'] app.config['LOCAL_UUID'] = os.environ['LOCAL_UUID'] @@ -36,7 +35,7 @@ app.config['PRODUCER_TIMEOUT'] = int(os.environ.get('PRODUCER_TIMEOUT', 60)) redis_client.init_app(app) for view in [ConsumersView, LogView, SyncView]: - view.register(app, trailing_slash=False) + view.register(app, trailing_slash = False) if __name__ == "__main__": - app.run(debug=True) + app.run(debug = True) diff --git a/consumer_api/tests/consumers_view_test.py b/consumer_api/tests/consumers_view_test.py index 7d8c8ea..9a80230 100644 --- a/consumer_api/tests/consumers_view_test.py +++ b/consumer_api/tests/consumers_view_test.py @@ -10,6 +10,7 @@ def client(): with current_app.test_client() as client: yield client + def test_response_length(client): r = client.post('/log') diff --git a/consumer_api/views/consumers_view.py b/consumer_api/views/consumers_view.py index 097c42d..cba9382 100644 --- a/consumer_api/views/consumers_view.py +++ b/consumer_api/views/consumers_view.py @@ -8,7 +8,6 @@ from flask_classful import FlaskView class ConsumersView(FlaskView): def get(self): - keys = redis_client.keys('consumer_*') list_of_customer_ips = [] diff --git a/consumer_api/views/log_view.py b/consumer_api/views/log_view.py index 2ebf4ff..206be0d 100644 --- a/consumer_api/views/log_view.py +++ b/consumer_api/views/log_view.py @@ -19,7 +19,8 @@ class LogView(FlaskView): if not last_known_remote_ip: current_app.logger.info(f"New producer {remote_uuid} at {remote_ip}") elif last_known_remote_ip != remote_ip: - current_app.logger.info(f"IP address of producer {remote_uuid} have changed: {last_known_remote_ip} -> {remote_ip}") + current_app.logger.info( + f"IP address of producer {remote_uuid} have changed: {last_known_remote_ip} -> {remote_ip}") # update expirity redis_client.set(prod_key, remote_ip.encode('utf-8')) @@ -28,4 +29,4 @@ class LogView(FlaskView): # print out message current_app.logger.info(f"New message: {request.json['message']}") - return Response(status=204) + return Response(status = 204)