diff --git a/README.md b/README.md index 76de5bfd6596f5f55e3b39b8a643468d0d34bc3e..fcd28b43e3bf66b7b458b42cc25dbbc7f09f6b67 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,12 @@ Here is an example of a script to log in and get the data import requests import json -loginResponse = requests.post("http://localhost:5000/login", json = {"email": "test@test.com", "password": "test"}) +host = "https://caimira-data-api.app.cern.ch" + +loginResponse = requests.post(f"{host}/login", json = {"email": "test@test.com", "password": "test"}) access_token = loginResponse.json()["access_token"] -response = requests.get("http://localhost:5000/data", headers={"Authorization": f"Bearer {access_token}"}) +response = requests.get(f"{host}/data", headers={"Authorization": f"Bearer {access_token}"}) data = response.json() ``` Data will be a json file similar to: diff --git a/app.py b/app.py index 85503fa1956a8c5e7c1ef76d8e636225a95449dc..e60bc510706ee40d62ed2b07a354d2288dec7fa9 100644 --- a/app.py +++ b/app.py @@ -5,7 +5,7 @@ from flask_migrate import Migrate import extensions import config import auth -from models import db, Data +from models import db from views import data app = Flask(__name__) @@ -20,12 +20,3 @@ app.register_blueprint(data.api) app.register_blueprint(auth.auth) auth.jwt.init_app(app) extensions.apispec.init_app(app) -with app.app_context(): - db.create_all() - - versions = db.session.query(Data).count() - if versions == 0: - dataRow = Data(version=0, json_blob={}, reason="Initial") - db.session.add(dataRow) - db.session.commit() - # print(get_all_tables(db))