Tags: http*

0 bookmark(s) - Sort by: Date ↓ / Title /

  1. 2014-05-20 Tags: , , by klotz
  2. The trick was to set stream = True in the get(). After this python process stopped to suck memory (statys around 30kb regardless size of the download file). Thank you @danodonovan for you syntax I use it here

    def download_file(url):
    local_filename = url.split('/') -1 »
    # NOTE the stream=True parameter
    r = requests.get(url, stream=True)
    with open(local_filename, 'wb') as f:
    for chunk in r.iter_content(chunk_size=1024):
    if chunk: # filter out keep-alive new chunks
    f.write(chunk)
    f.flush()
    return local_filename
    See http://docs.python-requests.org/en/latest/user/advanced/#body-content-workflow for further reference.
    2014-04-19 Tags: , , , by klotz
  3. 2014-01-23 Tags: by klotz
  4. 2013-10-18 Tags: , , by klotz
  5. 2013-10-08 Tags: , , by klotz
  6. 2013-10-06 Tags: , , , by klotz
  7. 2013-10-06 Tags: , , by klotz
  8. 2013-09-23 Tags: , , by klotz
  9. 2013-09-20 Tags: , by klotz
  10. 2013-07-16 Tags: , by klotz

Top of the page

First / Previous / Next / Last / Page 7 of 0 SemanticScuttle - klotz.me: tagged with "http"

About - Propulsed by SemanticScuttle