How to query id from the url? I want to get id from request so I tried this but it doesn't work.
My request url:http://localhost:8888/api/genshin?id=119480035 then it gives me 404.I expect it can query the id instead of 404
def do_GET(self):
if self.path == "/api/genshin":
# request url example: /api/genshin?id=119480035
id = self.path.split("=")[1]
data = asyncio.run(main(id))
self.send_response(200)
self.send_header('Content-type', 'application/json')
self.end_headers()
self.wfile.write(bytes(json.dumps(data), "utf-8"))
else:
self.send_response(404)
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write(bytes("<h1>404 Not Found</h1>", "utf-8"))