diff options
Diffstat (limited to 'python/fatcat_web/routes.py')
-rw-r--r-- | python/fatcat_web/routes.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py index 3f5af621..d41d6bdf 100644 --- a/python/fatcat_web/routes.py +++ b/python/fatcat_web/routes.py @@ -15,6 +15,7 @@ from fatcat_web.auth import handle_token_login, handle_logout, load_user, handle from fatcat_web.cors import crossdomain from fatcat_web.search import * from fatcat_web.entity_helpers import * +from fatcat_web.graphics import * ### Generic Entity Views #################################################### @@ -737,6 +738,20 @@ def container_ident_ia_coverage_years_json(ident): histogram = [dict(year=h[0], in_ia=h[1], count=h[2]) for h in histogram] return jsonify({'container_id': ident, "histogram": histogram}) +@app.route('/container/<ident>/ia_coverage_years.svg', methods=['GET', 'OPTIONS']) +@crossdomain(origin='*',headers=['access-control-allow-origin','Content-Type']) +def container_ident_ia_coverage_years_svg(ident): + try: + container = api.get_container(ident) + except ApiException as ae: + abort(ae.status) + try: + histogram = get_elastic_container_histogram(container.ident) + except Exception as ae: + app.log.error(ae) + abort(503) + return ia_coverage_histogram(histogram).render_response() + @app.route('/release/<ident>.bib', methods=['GET']) def release_bibtex(ident): try: |