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)