jeudi 22 janvier 2015

Python hold on the HTTP connection before sending files?

Problem


This problem has bothered me quite a long time. I'm dealing with a web API which provides the function that query the database by some specific conditions, fetch the qualified data back, and generate an .xls file for download.


However, the data amount is really really large, so generate the .xls file will relatively cost a long time. This may cause an HTTP Timeout. I used to created a generator to yield the records line by line formatted by .csv . It works well on the aspect of performance(I mean fast to generate and download), with some side effects, however. As I mentioned in the previous two questions:



Qeustions



After a serious consideration, I finally decide to generate the whole .xls file on the server side, and then provide for download. But how can I maintain the http connection during the time for generating the .xls file?



Aucun commentaire:

Enregistrer un commentaire