def get_data(): callout_file = csv.reader(get_file(DOWNLOAD_URL_2011)) next(callout_file) i = 1 for row in callout_file: # create an instance of Callout from csv row # and save it to the datastore CallOut.from_csv(row).put() i= i + 1 logging.info(i)
def get(self, date): dt = datetime.strptime(date, '%d-%m-%Y') incidents = CallOut.find_by_date(dt) self.response_write_json(incidents)
def get(self, station_area): incidents = CallOut.find_by_stationarea(station_area.upper()) self.response_write_json(incidents)
def get(self, district): calls = CallOut.find_by_district(district.upper()) self.response_write_json(calls)
def search(self, key): '''Gets the incident based on the datastore key''' key = ndb.Key(urlsafe=key) return CallOut.get_by_id(key.id())