From 6b4fbf97f047ec0dde829185c2349fbb44c884f6 Mon Sep 17 00:00:00 2001 From: Robin Universe Date: Sun, 4 Jul 2021 05:08:36 -0500 Subject: [PATCH] Added an embeded error message system to show when / why stuff might not be working --- templates/default.html | 14 ++++++++++++++ twitfix.py | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 templates/default.html diff --git a/templates/default.html b/templates/default.html new file mode 100644 index 0000000..375fdac --- /dev/null +++ b/templates/default.html @@ -0,0 +1,14 @@ +{% extends 'base.html' %} + +{% block head %} + TwitFix + + + + + +{% endblock %} + +{% block body %} + You will be redirected to this projects github page in a moment. +{% endblock %} \ No newline at end of file diff --git a/twitfix.py b/twitfix.py index 5ec71ad..0bac35d 100644 --- a/twitfix.py +++ b/twitfix.py @@ -43,12 +43,12 @@ def twitfix(subpath): except Exception: # Just to keep from 500s that are messy print(Exception) - return "Bad twitter link, try again" + return render_template('default.html', message="Failed to scan your twitter link! ( there is a chance I ran out of api calls.. wait a bit and try again )") return render_template('index.html', vidurl=result['url'], tweet=result['description'], pic=result['thumbnail'], user=result['uploader'], tweeturl=twitter_url) else: print("Link invalid") - return "Please use a twitter link" + return render_template('default.html', message="Please use a twitter link!") @app.route('/info/') def info(subpath):