summaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/routes.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-08-12 22:09:10 -0700
committerBryan Newbold <bnewbold@robocracy.org>2019-08-12 22:09:10 -0700
commitedbbecc7607d1e5a1321e6c6b7be6f733db84e99 (patch)
tree7fabfec92f6abed8f5369d937a7389a0f691610e /python/fatcat_web/routes.py
parentb6d79ead3c0a8d6617628c9e9a4db9d7c081e04c (diff)
downloadfatcat-edbbecc7607d1e5a1321e6c6b7be6f733db84e99.tar.gz
fatcat-edbbecc7607d1e5a1321e6c6b7be6f733db84e99.zip
default container stats by ident, not issnl
Diffstat (limited to 'python/fatcat_web/routes.py')
-rw-r--r--python/fatcat_web/routes.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py
index 393df33e..126bcdd0 100644
--- a/python/fatcat_web/routes.py
+++ b/python/fatcat_web/routes.py
@@ -687,7 +687,25 @@ def stats_json():
@crossdomain(origin='*',headers=['access-control-allow-origin','Content-Type'])
def container_issnl_stats(issnl):
try:
- stats = get_elastic_container_stats(issnl)
+ container = api.lookup_container(issnl=issnl)
+ except Exception as ae:
+ abort(ae.status)
+ try:
+ stats = get_elastic_container_stats(container.ident, issnl=container.issnl)
+ except Exception as ae:
+ app.log.error(ae)
+ abort(503)
+ return jsonify(stats)
+
+@app.route('/container/<ident>/stats.json', methods=['GET', 'OPTIONS'])
+@crossdomain(origin='*',headers=['access-control-allow-origin','Content-Type'])
+def container_ident_stats(ident):
+ try:
+ container = api.get_container(ident)
+ except Exception as ae:
+ abort(ae.status)
+ try:
+ stats = get_elastic_container_stats(container.ident, issnl=container.issnl)
except Exception as ae:
app.log.error(ae)
abort(503)