Coder Social home page Coder Social logo

Comments (5)

ross avatar ross commented on August 19, 2024

Perhaps adding an example of how to do it, or else just stating that it won't work.

I wouldn't expect it to work. The way things are currently written the callback is passed the full response so would wait until everything is back before invoking it. It might be possible to rework things, maybe adding another streaming friendly callback, but I'm not 100% sure what that would look like.

from requests-futures.

pkch avatar pkch commented on August 19, 2024

That makes sense.

I think callback can't work with streaming, if requests-futures only uses public API of request: the only way intermediate results are exposed in the public API is through the blocking iterator iter_lines. But I'm really not experienced in this at all, so maybe I just don't see something obvious.

from requests-futures.

ross avatar ross commented on August 19, 2024

Maybe if you describe your use case/reason for needing streaming in an async env I might be able to help. My intuition is that there's not a lot of cases where it'd buy much, but I wouldn't rule out that some could exist.

from requests-futures.

pkch avatar pkch commented on August 19, 2024

My use case is not too impressive. Just wanted to use Twitter streaming API to retrieve tweets in real-time, and then display update when something interesting happened - without blocking the main program.

from requests-futures.

ross avatar ross commented on August 19, 2024

My use case is not too impressive. Just wanted to use Twitter streaming API to retrieve tweets in real-time, and then display update when something interesting happened - without blocking the main program.

Ah. In that sort of setup you'd likely be better off directly using threading.Thread to create a (background) thread that makes the requests calls and does the stream processing. The futures paradigm pretty much just gets in the way there. Good luck.

from requests-futures.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.