Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
tbmc committed May 6, 2024
1 parent 282b073 commit 3b9bd8d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
21 changes: 10 additions & 11 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
from utils.calendar_converter import CalendarConverter
from utils.data_decoder import decode_data

logging.basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", datefmt="%Y-%m-%d %H:%M:%S",
level=logging.INFO)
logging.basicConfig(
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
datefmt="%Y-%m-%d %H:%M:%S",
level=logging.INFO,
)

app = flask.Flask(__name__)

CORS_HEADERS = {
'Access-Control-Allow-Origin': '*'
}
CORS_HEADERS = {"Access-Control-Allow-Origin": "*"}


def _list_teams_response() -> str:
Expand All @@ -36,17 +37,15 @@ def request_handler() -> flask.Response:

return flask.Response(
calendar_text,
headers={
"Content-Type": "text/calendar; charset=utf-8"
},
headers={"Content-Type": "text/calendar; charset=utf-8"},
mimetype="text/calendar",
)


@app.route("/api/list-teams")
def list_teams() -> flask.Response:
if flask.request.method == 'OPTIONS':
return flask.Response('', headers=CORS_HEADERS)
if flask.request.method == "OPTIONS":
return flask.Response("", headers=CORS_HEADERS)
try:
return flask.Response(_list_teams_response(), headers=CORS_HEADERS)
except Exception as e:
Expand All @@ -68,7 +67,7 @@ def serve_static_index() -> flask.Response:
data = flask.request.args.get("data", None)
if data is not None:
# Redirect user to /api if data is passed to keep compatibility
redirect_route = flask.url_for('main_request_api_handler')
redirect_route = flask.url_for("main_request_api_handler")
redirect_url = f"{redirect_route}?data={data}"
return flask.redirect(redirect_url)

Expand Down
4 changes: 1 addition & 3 deletions env_to_base64.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@

data_b64 = data_64.decode("utf-8")

encoded_data = urllib.parse.urlencode({
"data": data_b64
})
encoded_data = urllib.parse.urlencode({"data": data_b64})

print(f'Data: "{encoded_data}"\n')
print("Default URL:")
Expand Down

0 comments on commit 3b9bd8d

Please sign in to comment.