Make the response cleaner
This commit is contained in:
parent
49a50a0edd
commit
f65e3c603c
6
main.py
6
main.py
|
@ -5,9 +5,10 @@ Take existing calendar and update it slightly
|
|||
from datetime import date, datetime, time, timedelta
|
||||
|
||||
import requests
|
||||
from flask import Flask, Response, request
|
||||
from flask import Flask, Response, request, make_response
|
||||
from icalendar import Calendar, Event
|
||||
from werkzeug.middleware.proxy_fix import ProxyFix
|
||||
import logging
|
||||
|
||||
app = Flask(__name__)
|
||||
app.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1) # type: ignore[assignment]
|
||||
|
@ -29,7 +30,8 @@ def process() -> Response:
|
|||
mins = int(request.args.get("mins", "0"))
|
||||
|
||||
if orig.status_code != 200:
|
||||
return Response(orig.text, headers=orig.headers, status=orig.status_code)
|
||||
logging.warning("%s returned a %d", orig.request.url, orig.status_code)
|
||||
return make_response(orig.text, orig.status_code)
|
||||
|
||||
orig_cal = Calendar.from_ical(orig.text)
|
||||
cal = Calendar()
|
||||
|
|
Loading…
Reference in a new issue