Skip to content

Commit

Permalink
add 'name' route for star wars fans :)
Browse files Browse the repository at this point in the history
  • Loading branch information
gretel committed Mar 13, 2024
1 parent 6b26882 commit c17a0b9
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,27 @@
# Add a flask route to expose information
app.add_url_rule('/healthcheck', 'healthcheck', view_func=lambda: health.run())

@app.route("/pause", methods=["GET"])
@app.route("/")
def index():
return '<!doctype html><html lang=en><head><meta charset=utf-8><title>CBW</title></head><body><p>FSH35!</p></body></html>'

@app.route('/name/<name>')
def show(name):
return f'<!doctype html><html lang=en><head><meta charset=utf-8><title>CBW - Azure Wars</title></head><body ><p>Greetings, Master {name}!</p></body></html>'

@app.route("/pause")
def pause():
"""
"""
Returns True if the current time is in the following ranges: 9:30-9:45, 11:15-11:30
"""
import datetime
now = datetime.datetime.now(tz=datetime.timezone.utc)
now_cet = now.astimezone(tz=datetime.timezone(datetime.timedelta(hours=1)))
cond = str(
(
(9 <= now_cet.hour <= 9 and 30 <= now_cet.minute <= 45)
or (11 <= now_cet.hour <= 11 and 15 <= now_cet.minute <= 30)
)
)
return {"pause": cond}
import datetime
now = datetime.datetime.now(tz=datetime.timezone.utc)
now_cet = now.astimezone(tz=datetime.timezone(datetime.timedelta(hours=1)))
cond = str(((9 <= now_cet.hour <= 9 and 30 <= now_cet.minute <= 45)
or (11 <= now_cet.hour <= 11 and 15 <= now_cet.minute <= 30)))

return {"pause": cond}

@app.route("/")
def index():
return '<!doctype html><html lang=en><head><meta charset=utf-8><title>CBW</title></head><body><p>FSH35!</p></body></html>'

if __name__ == "__main__":
app.run()
app.run()

0 comments on commit c17a0b9

Please sign in to comment.