You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It also has two methods, sendRequest and stream. Unlike the python version, the signatures of those methods match quite well. It is worth noting that the two serious attempts at implementing this interface (so far) both couldn't manage to implement stream correctly. Although we could probably live without it in the most common case, streaming is paramount for downloading files (potentially large ones), which is a use case that we want to support.
We should simplify this interface and make it look the same in both versions. Any thoughts on how to achieve that? @vdusek@B4nan@barjin... and whoever else wants to chat 🙂
I like the JS version, but given many HTTP clients won't support streaming or it will be challenging to implement, I think we could have a default implementation of the stream method as part of the base class. So in JS instead of having an interface, it would be an abstract class with the stream method implemented with a fallback like we do with the curl-impersonate client.
I am not sure why there is that crawl method in python, if we don't support streaming there at all, ideally we would drop it (and implement a proxy at the call site if we need a different signature). Feels weird that crawler.run and send_request would use something else. And we should surely think of how to support streaming there too, but that's another story.
I am not sure why there is that crawl method in python, if we don't support streaming there at all, ideally we would drop it (and implement a proxy at the call site if we need a different signature). Feels weird that crawler.run and send_request would use something else. And we should surely think of how to support streaming there too, but that's another story.
Mostly historical reasons - the first attempt of implementation of HTTP clients. The crawl method is being called from the crawler.run, and send_request is being called from the send_request context helper. They have a slightly different APIs, but I believe they could be unified.
I like the JS version, but given many HTTP clients won't support streaming or it will be challenging to implement, I think we could have a default implementation of the stream method as part of the base class. So in JS instead of having an interface, it would be an abstract class with the stream method implemented with a fallback like we do with the curl-impersonate client.
I like the refactored version in JS as well and agree with the streaming. IMO it's acceptable if not all clients support streaming. A default implementation of the stream method in the base class, with a warning when it's not fully supported, would be okay fallback.
I like the JS version, but given many HTTP clients won't support streaming or it will be challenging to implement, I think we could have a default implementation of the stream method as part of the base class. So in JS instead of having an interface, it would be an abstract class with the stream method implemented with a fallback like we do with the curl-impersonate client.
I like the refactored version in JS as well and agree with the streaming. IMO it's acceptable if not all clients support streaming. A default implementation of the stream method in the base class, with a warning when it's not fully supported, would be okay fallback.
This is preferrable in the arguably common case when streaming cannot be implemented. I can't shake the feeling that stream-based implementations should be the default because it's easy to read a stream into memory when needed, but doing it the other way around nullifies the benefit of streams. Plus it's not nice to require people to implement both a streaming and non-streaming version.
Yeah, crawl is kinda unnecessary now and the HttpClient interface should be cleaned up - ideally to the point that there is a single stream-enabled method. Let's keep this open.
Activity
B4nan commentedon Jan 15, 2025
I like the JS version, but given many HTTP clients won't support streaming or it will be challenging to implement, I think we could have a default implementation of the
streammethod as part of the base class. So in JS instead of having an interface, it would be an abstract class with the stream method implemented with a fallback like we do with the curl-impersonate client.I am not sure why there is that
crawlmethod in python, if we don't support streaming there at all, ideally we would drop it (and implement a proxy at the call site if we need a different signature). Feels weird thatcrawler.runandsend_requestwould use something else. And we should surely think of how to support streaming there too, but that's another story.vdusek commentedon Jan 16, 2025
Mostly historical reasons - the first attempt of implementation of HTTP clients. The
crawlmethod is being called from thecrawler.run, andsend_requestis being called from thesend_requestcontext helper. They have a slightly different APIs, but I believe they could be unified.I like the refactored version in JS as well and agree with the streaming. IMO it's acceptable if not all clients support streaming. A default implementation of the stream method in the base class, with a warning when it's not fully supported, would be okay fallback.
janbuchar commentedon Jan 16, 2025
This is preferrable in the arguably common case when streaming cannot be implemented. I can't shake the feeling that stream-based implementations should be the default because it's easy to read a stream into memory when needed, but doing it the other way around nullifies the benefit of streams. Plus it's not nice to require people to implement both a streaming and non-streaming version.
B4nan commentedon Dec 4, 2025
I guess that one can be closed after all the refactoring in v1? Feel free to reopen if not.
vdusek commentedon Dec 4, 2025
I'm not sure. We didn't do much on the HTTP clients before the v1 release, and there are still send_request and crawl in Python and send_request and stream in the TS version.
cc @janbuchar
janbuchar commentedon Dec 4, 2025
Yeah,
crawlis kinda unnecessary now and theHttpClientinterface should be cleaned up - ideally to the point that there is a single stream-enabled method. Let's keep this open.vdusek commentedon Dec 4, 2025
This is evolving in Crawlee JS v4 (
fetch,sendRequest,applyCookies, ...); let's unify this in Crawlee Python v2.0.vdusek commentedon Jul 15, 2026
Another discussion relevant to this topic: #2043 (comment)