Advertisement
Grenight

Untitled

Sep 15th, 2019
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1.  with requests.get(download_link,stream=True, headers=headers) as r:
  2.                     r.raise_for_status()
  3.                     with open('file.pdf', 'wb') as f:
  4.                         for chunk in r.iter_content(chunk_size=8192):
  5.                             if chunk:  # filter out keep-alive new chunks
  6.                                 f.write(chunk)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement