Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Review ch9 #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions ch9/circuit_breaker.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -11,7 +13,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="")
Expand Down
2 changes: 1 addition & 1 deletion ch9/retry/retry_database_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
4 changes: 1 addition & 3 deletions ch9/throttling_flaskapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -26,4 +24,4 @@ def more_limited_api():


if __name__ == "__main__":
app.run(debug=True)
app.run(debug=True) # nosec