diff --git a/gitea-to-ics.py b/gitea-to-ics.py index 3a7dfa5..1a7b4bf 100644 --- a/gitea-to-ics.py +++ b/gitea-to-ics.py @@ -49,7 +49,7 @@ def process_combined(combined): return cal.to_ical() def get_token(input_token): - token = input_token.lstrip("Basic ") + token = input_token.removeprefix("Basic ") token = b64decode(token).decode('utf8', 'ignore') with cherrypy.HTTPError.handle(ValueError, 401): _, token = token.split(":", 2) @@ -58,6 +58,8 @@ def get_token(input_token): class Root: @cherrypy.expose def todo(self): + cherrypy.response.headers['WWW-Authenticate'] = \ + 'Basic realm="ICS access"' authorization = cherrypy.request.headers.get('Authorization', ':') if not authorization: raise cherrypy.HTTPError(401, 'Unauthorized')