From f368b3e047d14055bc63899771c782ebbb8c6553 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Mon, 20 Jul 2020 11:31:13 +0100 Subject: Start Public REST API --- bh20simplewebuploader/__init__.py | 1 + bh20simplewebuploader/api.py | 16 ++++++++++++++++ bh20simplewebuploader/main.py | 5 ----- 3 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 bh20simplewebuploader/api.py (limited to 'bh20simplewebuploader') diff --git a/bh20simplewebuploader/__init__.py b/bh20simplewebuploader/__init__.py index e69de29..2dcc632 100644 --- a/bh20simplewebuploader/__init__.py +++ b/bh20simplewebuploader/__init__.py @@ -0,0 +1 @@ +import bh20simplewebuploader.api diff --git a/bh20simplewebuploader/api.py b/bh20simplewebuploader/api.py new file mode 100644 index 0000000..8bd1a22 --- /dev/null +++ b/bh20simplewebuploader/api.py @@ -0,0 +1,16 @@ +# Public API for PubSeq + +import sys +import requests + +from flask import Flask, request, redirect, send_file, send_from_directory, render_template, jsonify +from bh20simplewebuploader.main import app + +@app.route('/api/version') +def version(): + return jsonify({ 'service': 'PubSeq', 'version': 0.10 }) + +@app.route('/api/ebi/sample-.xml', methods=['GET']) +def ebi_sample(id): + page = render_template('ebi-sample.xml',**locals()) + return page diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py index b40db6f..aad607d 100644 --- a/bh20simplewebuploader/main.py +++ b/bh20simplewebuploader/main.py @@ -936,8 +936,3 @@ def getSEQbyLocationAndSpecimenSource(): r = requests.get(baseURL, params=payload) result = r.json()['results']['bindings'] return str(result) - -@app.route('/api/ebi/sample-.xml', methods=['GET']) -def ebi_sample(id): - page = render_template('ebi-sample.xml',**locals()) - return page -- cgit v1.2.3