Save a large file using the Python requests library [duplicate]
Oddly enough, requests doesn’t have anything simple for this. You’ll have to iterate over the response and write those chunks to a file: response = requests.get(‘http://www.example.com/image.jpg’, stream=True) # Throw an error for bad status codes response.raise_for_status() with open(‘output.jpg’, ‘wb’) as handle: for block in response.iter_content(1024): handle.write(block) I usually just use urllib.urlretrieve(). It works, but if … Read more