示例#1
0
 def get(self, *args):
     year, month, day = map(int, args)
     try:
         lunch = fetch_historic_lunch(year, month, day)
         self.response.out.write(format_lunch(lunch).encode("utf-8"))
     except ValueError:  # nie ma takiego w historii
         self.response.out.write("Brak lanczu w bazie")
         self.response.set_status(404)
示例#2
0
 def get(self, *args):
     year, month, day = map(int, args)
     try:
         lunch = fetch_historic_lunch(year, month, day)
         self.response.headers.add_header("Content-Type", "application/json")
         self.response.out.write(json.dumps(lunch))
     except ValueError:
         self.response.out.write("{}")
         self.response.set_status(404)