adds backend script which can be run as a cronjob every n minutes to generate new json files for google calendars

- database updated to save google credentials
- database updated to save json calendar information
- json still saved as a json file under userinfo/<user.id>/calendarevents.json
This commit is contained in:
2020-04-24 17:54:56 +00:00
parent a071193959
commit c89ecd7134
8 changed files with 84 additions and 7 deletions

View File

@ -82,8 +82,7 @@ def googlelogin():
@app.route("/login/google/callback")
def callback():
session = google.verifyResponse()
session, credentials = google.verifyResponse()
userinfo = session.get('https://www.googleapis.com/userinfo/v2/me').json()
# Create a user in your db with the information provided
@ -107,7 +106,7 @@ def callback():
print("login:" + user.id)
login_user(user)
user.setGoogleCredentials(credentials)
return flask.redirect(flask.url_for('index'))
@app.route("/logout")
@ -128,7 +127,7 @@ def credentials_to_dict(credentials):
@app.route("/userinfo/<path:user>/calendarevents.json")
def downloader(user):
print(user)
path = "/home/raphael/dev/website_ws/website/userinfo/" + user
path = "userinfo/" + user
return flask.send_from_directory(path, "calendarevents.json")
# POST