aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web
diff options
context:
space:
mode:
Diffstat (limited to 'python/fatcat_web')
-rw-r--r--python/fatcat_web/routes.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py
index 126bcdd0..5789dc48 100644
--- a/python/fatcat_web/routes.py
+++ b/python/fatcat_web/routes.py
@@ -686,9 +686,12 @@ def stats_json():
@app.route('/container/issnl/<issnl>/stats.json', methods=['GET', 'OPTIONS'])
@crossdomain(origin='*',headers=['access-control-allow-origin','Content-Type'])
def container_issnl_stats(issnl):
+ if not (len(issnl) == 9 and issnl[4] == '-'):
+ flash("Not a valid ISSN-L: {}".format(issnl))
+ abort(400)
try:
container = api.lookup_container(issnl=issnl)
- except Exception as ae:
+ except ApiException as ae:
abort(ae.status)
try:
stats = get_elastic_container_stats(container.ident, issnl=container.issnl)
@@ -702,7 +705,7 @@ def container_issnl_stats(issnl):
def container_ident_stats(ident):
try:
container = api.get_container(ident)
- except Exception as ae:
+ except ApiException as ae:
abort(ae.status)
try:
stats = get_elastic_container_stats(container.ident, issnl=container.issnl)