Fix links from info and meta feeds

This commit is contained in:
Julius Freudenberger 2023-02-04 20:34:59 +01:00
parent 199048207a
commit f993969a68
2 changed files with 4 additions and 4 deletions

6
app.py
View file

@ -15,12 +15,12 @@ VIRTUAL_HOST = os.getenv('VIRTUAL_HOST')
@app.route('/mensa/<parser_name>.json') @app.route('/mensa/<parser_name>.json')
def index(parser_name): def index(parser_name):
try: try:
return utils.get_parser(parser_name).get_canteen_index(f'http://{VIRTUAL_HOST}/meta') return utils.get_parser(parser_name).get_canteen_index(f'http://{VIRTUAL_HOST}/mensa/{parser_name}/meta')
except KeyError: except KeyError:
abort(404) abort(404)
@app.route('/mensa/<parser_name>/meta/<canteen_name>') @app.route('/mensa/<parser_name>/meta/<canteen_name>.xml')
def meta(parser_name, canteen_name): def meta(parser_name, canteen_name):
try: try:
return utils.get_parser(parser_name).get_meta_data(canteen_name, f'http://{VIRTUAL_HOST}/mensa/{parser_name}/feed') return utils.get_parser(parser_name).get_meta_data(canteen_name, f'http://{VIRTUAL_HOST}/mensa/{parser_name}/feed')
@ -28,7 +28,7 @@ def meta(parser_name, canteen_name):
abort(404) abort(404)
@app.route('/mensa/<parser_name>/feed/<canteen_name>') @app.route('/mensa/<parser_name>/feed/<canteen_name>.xml')
def mensa(parser_name, canteen_name): def mensa(parser_name, canteen_name):
try: try:
return utils.get_parser(parser_name).get_meal_data(canteen_name) return utils.get_parser(parser_name).get_meal_data(canteen_name)

View file

@ -50,7 +50,7 @@ class Parser:
meta_data.city = canteen.city meta_data.city = canteen.city
meta_data.availability = 'public' if canteen.public else 'restricted' meta_data.availability = 'public' if canteen.public else 'restricted'
meta_data.feeds.append( meta_data.feeds.append(
Feed('full', priority='0', url=f'{prefix}/{canteen.canteen_id}', source=canteen.source, dayOfWeek='*', dayOfMonth='*', Feed('full', priority='0', url=f'{prefix}/{canteen.canteen_id}.xml', source=canteen.source, dayOfWeek='*', dayOfMonth='*',
hour='9', minute='30', retry='60 1 1440')) hour='9', minute='30', retry='60 1 1440'))
return meta_data.toXMLFeed() return meta_data.toXMLFeed()