def getInfo(secret): if secret not in secretsKeep.keys(): return notFoundHTML(secret) secretKept = secretsKeep[secret] del secretsKeep[secret] if datetime.now() > secretKept.expires: return notFoundHTML(secret) otherUserId = secretKept.userId params = {'access_token': authentication.loggedUsers[otherUserId].token} resp = requests.get("https://fenix.tecnico.ulisboa.pt/api/fenix/v1/person", params=params) secretsUsed[otherUserId] = authentication.getUserId() return resp.text
def getSecretariatPage(identifier): try: secretariat = secretariats.getSecretariat(identifier) return render_template("showSecretariat.html", secretariat=secretariat) except microservices.NotFoundErrorException: return notFoundHTML(identifier) except microservices.ServerErrorException: return serverErrorHTML()
def canteenlistall(): try: canteen = canteens.apiListMenus() return render_template("listalldays.html", chosen_day=canteen) except microservices.NotFoundErrorException: return notFoundHTML("") except microservices.ServerErrorException: return serverErrorHTML()
def listSecretariatsPage(): try: secretariatsList = secretariats.listSecretariats() return render_template("listSecretariats.html", secretariats=secretariatsList) except microservices.NotFoundErrorException: return notFoundHTML("") except microservices.ServerErrorException: return serverErrorHTML()
def showRoom(identifier): r_id = int(identifier) try: room = rooms.getRoom(r_id) return render_template("showRoom.html", chosen_room=room, all=room['timetable']) except microservices.NotFoundErrorException: return notFoundHTML(r_id) except microservices.ServerErrorException: return serverErrorHTML()
def canteenShow(identifier): c_id = int(identifier) try: canteen = canteens.getDay(c_id) return render_template("listCanteen.html", chosen_day=canteen) except microservices.NotFoundErrorException: return notFoundHTML(c_id) except microservices.ServerErrorException: return serverErrorHTML() else: pass
def generalRoute(microservice, path=""): newmicro = microservices.Microservices() try: json = newmicro.validateAndParseResponse( newmicro.serviceGet(microservice)) html = ext.jsontoHTML(json) html = ext.addHeaders(html) return html except KeyError: return notFoundHTML(microservice) except microservices.ServerErrorException: return serverErrorHTML() else: pass