diff --git a/app.py b/app.py index a0ad70f..539d658 100644 --- a/app.py +++ b/app.py @@ -24,9 +24,12 @@ def index(): @app.route('/get_quote') def get_quote(): - with open('quotes.txt', 'r') as f: - quotes = f.readlines() - return random.choice(quotes) + try: + with open('quotes.txt', 'r') as f: + quotes = f.readlines() + return random.choice(quotes).strip() + except FileNotFoundError: + return "No quotes available." (""for handling errors in quotes"") @app.route('/back') def back():