I am using FastAPI to return a video response from googlevideo.com. This is the code I am using: @app.get(params.api_video_route) async def get_api_video(url=None): def iter(): req = urllib.request.Request(url) with urllib.request.urlopen(req) as resp: yield from io.BytesIO(resp.read()) return StreamingResponse(iter(), media_type="video/mp4") but this is not working I want this Nodejs to be converted into Python FastAPI: app.get("/download-video", function(req, res) { http.get(decodeURIComponent(req.query.url), function(response) { res.setHeader("Content-Length", response.headers["content-length"]); if (response.statusCode >= 400) res.status(500).send("Error"); response.on("data", function(chunk) { res.write(chunk); }); response.on("end", function() { res.end(); }); }); }); Continue reading...