aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-03-18 14:52:22 -0700
committerBryan Newbold <bnewbold@robocracy.org>2019-03-18 14:52:49 -0700
commit3d82671bd350681c62b53125b887b01543e8ad7c (patch)
tree72f6fe4ef4af1d73cc77bb2530e545e855287594 /python/fatcat_web
parent704ea367439f6faf88343b5ee50a438900c96aca (diff)
downloadfatcat-3d82671bd350681c62b53125b887b01543e8ad7c.tar.gz
fatcat-3d82671bd350681c62b53125b887b01543e8ad7c.zip
some API-like routes are unstable
Diffstat (limited to 'python/fatcat_web')
-rw-r--r--python/fatcat_web/routes.py35
-rw-r--r--python/fatcat_web/templates/stats.html2
2 files changed, 20 insertions, 17 deletions
diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py
index 7a254f52..d660da86 100644
--- a/python/fatcat_web/routes.py
+++ b/python/fatcat_web/routes.py
@@ -119,16 +119,6 @@ def creator_history(ident):
entity=entity,
history=history)
-@app.route('/container/issnl/<issnl>/stats.json', methods=['GET', 'OPTIONS'])
-@crossdomain(origin='*',headers=['access-control-allow-origin','Content-Type'])
-def container_issnl_stats(issnl):
- try:
- stats = get_elastic_container_stats(issnl)
- except Exception as ae:
- print(ae)
- abort(503)
- return jsonify(stats)
-
@app.route('/creator/<ident>/edit', methods=['GET'])
def creator_edit_view(ident):
try:
@@ -505,7 +495,19 @@ def get_changelog_stats():
}}
return stats
-@app.route('/stats.json', methods=['GET', 'OPTIONS'])
+@app.route('/stats', methods=['GET'])
+def stats_page():
+ try:
+ stats = get_elastic_entity_stats()
+ stats.update(get_changelog_stats())
+ except Exception as ae:
+ print(ae)
+ abort(503)
+ return render_template('stats.html', stats=stats)
+
+### Pseudo-APIs #############################################################
+
+@app.route('/unstable/stats.json', methods=['GET', 'OPTIONS'])
@crossdomain(origin='*',headers=['access-control-allow-origin','Content-Type'])
def stats_json():
try:
@@ -516,15 +518,16 @@ def stats_json():
abort(503)
return jsonify(stats)
-@app.route('/stats', methods=['GET'])
-def stats_page():
+@app.route('/unstable/container/issnl/<issnl>/stats.json', methods=['GET', 'OPTIONS'])
+@app.route('/container/issnl/<issnl>/stats.json', methods=['GET', 'OPTIONS'])
+@crossdomain(origin='*',headers=['access-control-allow-origin','Content-Type'])
+def container_issnl_stats(issnl):
try:
- stats = get_elastic_entity_stats()
- stats.update(get_changelog_stats())
+ stats = get_elastic_container_stats(issnl)
except Exception as ae:
print(ae)
abort(503)
- return render_template('stats.html', stats=stats)
+ return jsonify(stats)
### Auth ####################################################################
diff --git a/python/fatcat_web/templates/stats.html b/python/fatcat_web/templates/stats.html
index f11ca820..7f56248f 100644
--- a/python/fatcat_web/templates/stats.html
+++ b/python/fatcat_web/templates/stats.html
@@ -3,7 +3,7 @@
<h1>Stats</h1>
-You can also fetch these numbers <a href="./stats.json">as JSON</a>.
+You can also fetch these numbers <a href="./unstable/stats.json">as JSON</a>.
<h3>Changelog</h3>