def do_GET(self): print(self.path) lat, lon = self.latlong_re.match(self.path).groups() st = geocode.streetname(lat, lon) # Send a response self.send_response(200) self.send_header("content-type", "text/plain") self.end_headers() self.wfile.write(json.dumps(st).encode("utf-8"))