beta #4
@ -24,7 +24,8 @@ app:
|
||||
real_url: https://www.thsf.net
|
||||
pretalx:
|
||||
url: https://23.thsf.net
|
||||
apikey: sdfsdfsdf
|
||||
apiprefix: api
|
||||
apikey: bb770a53b15467dfb67c03d178004aca9e4819d6
|
||||
event: thsf-2023
|
||||
schedule: wip
|
||||
|
||||
|
@ -3,3 +3,4 @@ wheel
|
||||
flask
|
||||
gunicorn
|
||||
pyYAML
|
||||
requests
|
||||
|
@ -22,6 +22,7 @@ install_requires =
|
||||
flask
|
||||
gunicorn
|
||||
pyYAML
|
||||
request
|
||||
|
||||
[options.packages.find]
|
||||
where = src
|
||||
|
@ -3,6 +3,7 @@ import logging
|
||||
from logging import config
|
||||
import yaml
|
||||
from flask import Flask, render_template, redirect, request, url_for
|
||||
from thsf.backend import Backend
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
@ -30,6 +31,9 @@ try:
|
||||
app.config["SECRET_KEY"] = app.local_config["app"]["secret_key"]
|
||||
app.config["LANGUAGES"] = app.local_config["app"]["languages"]
|
||||
config.dictConfig(app.local_config["log"])
|
||||
backend = Backend(url=app.local_config["pretalx"]["url"],
|
||||
apiprefix=app.local_config["pretalx"]["apiprefix"],
|
||||
apikey=app.local_config["pretalx"]["apikey"])
|
||||
except Exception as err:
|
||||
logger.critical("[{}] {}".format(err.__class__, str(err)))
|
||||
sys.exit(1)
|
||||
@ -56,6 +60,7 @@ def index():
|
||||
|
||||
@app.route('/planning', methods=['GET'])
|
||||
def planning():
|
||||
backend.get(endpoint=f"events/{app.local_config['pretalx']['event']}/schedules/{app.local_config['pretalx']['schedule']}")
|
||||
return "planning"
|
||||
|
||||
@app.route('/concerts', methods=['GET'])
|
||||
|
15
src/thsf/backend/__init__.py
Normal file
15
src/thsf/backend/__init__.py
Normal file
@ -0,0 +1,15 @@
|
||||
import requests
|
||||
|
||||
|
||||
class Backend(url, apiprefix, apikey):
|
||||
def __init__(self, url, apiprefix, apikey):
|
||||
self.url = url
|
||||
self.apiprefix = apiprefix
|
||||
self.apikey = apikey
|
||||
self.session = requests.Session()
|
||||
|
||||
def get(self, endpoint, params=None):
|
||||
url = f"{self.url}/{self.apiprefix}/{endpoint}"
|
||||
headers = {f"Authorization: Token {self.apikey}"}
|
||||
return self.session.get(url, **{"params": params, "headers": headers})
|
||||
|
@ -23,7 +23,8 @@
|
||||
<div id="navbar_wrapper">
|
||||
<i class="button tooltip black fa-regular fa-calendar"
|
||||
title="Programme"
|
||||
alt="Programme">
|
||||
alt="Programme"
|
||||
onclick="document.location='/planning'">
|
||||
<span class="tooltiptext thin">Programme</span>
|
||||
</i>
|
||||
<i class="button tooltip black fa-solid fa-map-location-dot"
|
||||
|
Loading…
Reference in New Issue
Block a user