import webapp2
import csv
import time

from google.appengine.api import logservice

class Level1Handler(webapp2.RequestHandler):
  def get(self):
    self.response.headers['content-type'] = 'text/plain'    
    # Create a csv writer that outputs to the HTTP response
    w = csv.writer(self.response)
    now = time.time()
    # Fetch last 5 minutes of request logs
    # TODO: missing arg: start_time
    for r in logservice.fetch(start_time=TODO):
      # Render them as plain text in CSV format in the response body
      # TODO: missing args: `r` RequestLog attributes
      w.writerow([r.TODO, r.TODO, r.TODO,
                  r.TODO, r.TODO, r.TODO,
                  r.TODO if r.TODO else "NULL"])])

app = webapp2.WSGIApplication([('/level1', Level1Handler)], debug=True)