remove unnecessary exception class

This commit is contained in:
iliana etaoin 2021-02-11 21:08:43 -08:00
parent 99b58f2713
commit 4e70bdc321
No known key found for this signature in database
GPG Key ID: 4B1B8478D7E0DF1A
1 changed files with 1 additions and 7 deletions

View File

@ -24,10 +24,6 @@ from flask import Flask, redirect, render_template, request, url_for
app = Flask(__name__)
class ForbiddenEndpointError(Exception):
pass
@app.route("/<domain>")
def emojo(domain):
if request.args.get("show_all", "") == "on":
@ -45,7 +41,7 @@ def emojo(domain):
)
response = requests.get(url)
if response.status_code == 401:
raise ForbiddenEndpointError
return render_template("forbidden.html", domain=domain)
if show_all:
emojo = sorted(response.json(), key=operator.itemgetter("shortcode"))
@ -59,8 +55,6 @@ def emojo(domain):
)
except requests.exceptions.RequestException:
return render_template("oh_no.html", domain=domain)
except ForbiddenEndpointError:
return render_template("forbidden.html", domain=domain)
@app.route("/favicon.ico")