From 1cb7d7242f3fd120f825c0fbb9d8364e6e751105 Mon Sep 17 00:00:00 2001 From: Robbe Van Herck Date: Wed, 13 May 2020 02:50:14 +0200 Subject: [PATCH] Make it a server --- app.py | 16 +++++++++++++++- requirements.txt | 6 ++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 7b7b9cf..8cab2fc 100644 --- a/app.py +++ b/app.py @@ -3,6 +3,13 @@ from httplib2 import Http from google.oauth2 import service_account import json +# Flask shizzle +from flask import Flask +from flask_cors import CORS, cross_origin +app = Flask(__name__) +cors = CORS(app) +app.config['CORS_HEADERS'] = 'Content-Type' + import configparser CONFIG = configparser.ConfigParser() CONFIG.read("config.ini") @@ -56,4 +63,11 @@ def create_point(row): } } -print(google_sheet_to_json()) +@app.route('/data.json') +@cross_origin() +def data_json(): + return google_sheet_to_json() + + +if __name__ == "__main__": + app.run() diff --git a/requirements.txt b/requirements.txt index 6e0e6dc..44e2e15 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,8 @@ cachetools==4.1.0 certifi==2020.4.5.1 chardet==3.0.4 +click==7.1.2 +Flask==1.1.2 google-api-core==1.17.0 google-api-python-client==1.8.2 google-auth==1.14.3 @@ -8,6 +10,9 @@ google-auth-httplib2==0.0.3 googleapis-common-protos==1.51.0 httplib2==0.17.3 idna==2.9 +itsdangerous==1.1.0 +Jinja2==2.11.2 +MarkupSafe==1.1.1 protobuf==3.11.3 pyasn1==0.4.8 pyasn1-modules==0.2.8 @@ -17,3 +22,4 @@ rsa==4.0 six==1.14.0 uritemplate==3.0.1 urllib3==1.25.9 +Werkzeug==1.0.1