title: PycURL Attachments and Progress Functions
body: <p>Working on a small project utilising an API that you send a request to and then it gives you back a response with a zip file attached which you then download. My first pass at automating this download tried to utilise the setopt(curl.WRITEDATA, fp) function but this proceeded to crash my Python script every time I tried. I then changed tack and used WRITEFUNCTION instead to write the data to a buffer then write that out to a file which works fine consistently.</p>
  
  <p>This was all fine but then I wanted to add a progress bar to see how much of the file had been downloaded and give some user feedback etc. This is where things started to get strange because now the progress bar gets to 100% within a second and the zip file has not completed its download. When I altered my progress function to just print the size of the file it was downloading it reports a number of the order of a few 100 bytes (much smaller than the zip file). Is there anyway to use the functions in pycurl (and curl underneath) to track the progress of the attachment download as opposed to the request itself?</p>
  
  <p>Also if anyone could help with the WRITEDATA problem that might help as well, I guess the two problems might be connected.</p>