streaming

FastAPI StreamingResponse not streaming with generator function

FastAPI StreamingResponse not streaming with generator function Question: I have a relatively simple FastAPI app that accepts a query and streams back the response from ChatGPT’s API. ChatGPT is streaming back the result and I can see this being printed to console as it comes in. What’s not working is the StreamingResponse back via FastAPI. …

Total answers: 4

Problem with Django StreamingHttpResponse

Problem with Django StreamingHttpResponse Question: I’m having a problem with Django response class StreamingHttpResponse. When I return a generator as response using StreamingHttpResponse and make a request I excepted to retrieve each data block one by one, instead of that i retrieve the full data at once when the generator loop has finished. My Django …

Total answers: 2

POST NSData to a Server

POST NSData to a Server Question: I am trying to POST the iPhone depth data to a Macbook using wifi (at-least 30 fps). I extracted depth CVPixelBuffer from ARSession followed by creating an NSMutableData. My question is that how I can POST this message (NSMutableData) to a server? In the meantime, how can I GET …

Total answers: 1

How to replace hyperlinks in StreamingResponse?

How to replace hyperlinks in StreamingResponse? Question: Is that possible to replace hyperlinks in StreamingResponse? I’m using below code to stream HTML content. from starlette.requests import Request from starlette.responses import StreamingResponse from starlette.background import BackgroundTask import httpx client = httpx.AsyncClient(base_url="http://containername:7800/") async def _reverse_proxy(request: Request): url = httpx.URL(path=request.url.path, query=request.url.query.encode("utf-8")) rp_req = client.build_request( request.method, url, headers=request.headers.raw, content=await …

Total answers: 1

How to stream HTML content with static files using FastAPI?

How to stream HTML content with static files using FastAPI? Question: Question How to stream an HTML page with static files and hyperlinks from another service using FastAPI? Additional Context A common architecture in micro-services is to have a gateway layer that implements a public API that passes requests to micro-services. =============== Docker Network ============= …

Total answers: 1

Trying to run background task while simultaneously updating the view in django

Trying to run background task while simultaneously updating the view in django Question: I’m working on a project analysing real time data and plotting it in a graph that updates every 10 seconds. I’ve been trying to make a django web app of this little program but I’m not sure how to: Run a background …

Total answers: 2

Including filtering-criteria in Tweepy Streaming API

Including filtering-criteria in Tweepy Streaming API Question: I would like to collect all tweets that contain on the following words: Bitcoin, Ethereum, Litecoin or Denarius However, I want to exclude tweets than can be classified as retweets and tweets that contain links. I know from the following website (https://www.followthehashtag.com/help/hidden-twitter-search-operators-extra-power-followthehashtag) that I can add -filter:links to …

Total answers: 1

Understanding Python HTTP streaming

Understanding Python HTTP streaming Question: I’m struggling to access a streaming API using Python and Requests. What the API says: "We’ve enabled a streaming endpoint to for requesting both quote and trade data utilizing a persistent HTTP socket connection. Streaming data from the API consists of making an Authenticated HTTP request and leaving the HTTP …

Total answers: 3

How to send image generated by PIL to browser?

How to send image generated by PIL to browser? Question: I’m using flask for my application. I’d like to send an image (dynamically generated by PIL) to client without saving on disk. Any idea how to do this ? Asked By: user795243 || Source Answers: First, you can save the image to a tempfile and …

Total answers: 6