From 539bbea807c4abc75cea05d3ac381a449480cb5e Mon Sep 17 00:00:00 2001 From: Encolpe DEGOUTE Date: Thu, 2 May 2024 02:02:09 +0200 Subject: [PATCH 1/5] Remove double import --- ch9/throttling_flaskapp.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/ch9/throttling_flaskapp.py b/ch9/throttling_flaskapp.py index 9f670d0..fe96b3a 100644 --- a/ch9/throttling_flaskapp.py +++ b/ch9/throttling_flaskapp.py @@ -2,8 +2,6 @@ from flask_limiter import Limiter from flask_limiter.util import get_remote_address -from flask import Flask - app = Flask(__name__) limiter = Limiter( get_remote_address, From 0fde0a41bb1ec4a26f5d6aee246131aa427cc5d6 Mon Sep 17 00:00:00 2001 From: Encolpe DEGOUTE Date: Thu, 2 May 2024 02:03:54 +0200 Subject: [PATCH 2/5] Remove bandit warning --- ch9/throttling_flaskapp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ch9/throttling_flaskapp.py b/ch9/throttling_flaskapp.py index fe96b3a..ff2e45a 100644 --- a/ch9/throttling_flaskapp.py +++ b/ch9/throttling_flaskapp.py @@ -24,4 +24,4 @@ def more_limited_api(): if __name__ == "__main__": - app.run(debug=True) + app.run(debug=True) # nosec From ab4448a4c69832879e1ace5a3f5b6bfd270a34a1 Mon Sep 17 00:00:00 2001 From: Encolpe DEGOUTE Date: Thu, 2 May 2024 03:25:25 +0200 Subject: [PATCH 3/5] Remove bandit warning --- ch9/circuit_breaker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ch9/circuit_breaker.py b/ch9/circuit_breaker.py index 9bd3279..95db0d3 100644 --- a/ch9/circuit_breaker.py +++ b/ch9/circuit_breaker.py @@ -11,7 +11,7 @@ @breaker def fragile_function(): - if not random.choice([True, False]): + if not random.choice([True, False]): # nosec print(" / OK", end="") else: print(" / FAIL", end="") From 139484d7267c71f9062036416542ced3eaeb0177 Mon Sep 17 00:00:00 2001 From: Encolpe DEGOUTE Date: Thu, 2 May 2024 03:28:56 +0200 Subject: [PATCH 4/5] Use docstring instead of comment --- ch9/circuit_breaker.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ch9/circuit_breaker.py b/ch9/circuit_breaker.py index 95db0d3..1084929 100644 --- a/ch9/circuit_breaker.py +++ b/ch9/circuit_breaker.py @@ -1,4 +1,6 @@ -# our version of a script provided in https://github.com/veltra/pybreaker-playground +""" +Our version of a script provided in https://github.com/veltra/pybreaker-playground. +""" import pybreaker from datetime import datetime From f51be709a4361237d6b5924507687d9a65c064ed Mon Sep 17 00:00:00 2001 From: Encolpe DEGOUTE Date: Thu, 2 May 2024 03:31:16 +0200 Subject: [PATCH 5/5] Remove bandit warning --- ch9/retry/retry_database_connection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ch9/retry/retry_database_connection.py b/ch9/retry/retry_database_connection.py index 9bd6f1c..5d6921f 100644 --- a/ch9/retry/retry_database_connection.py +++ b/ch9/retry/retry_database_connection.py @@ -23,7 +23,7 @@ def wrapper(*args, **kwargs): @retry(attempts=3) def connect_to_database(): - if random.randint(0, 1): + if random.randint(0, 1): # nosec raise Exception("Temporary Database Error") return "Connected to Database"