Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. # Streaming a `requests` response as a file
  2. In many applications, you'd like to access a `requests` response as a file-like object, simply having `.read()`, `.seek()`, and `.tell()` as normal. Especially when you only want to *partially* download a file, it'd be extra convenient if you could use a normal file interface for it, loading as needed.
  3.  
  4. This is a wrapper class for doing that. Only bytes you request will be loaded - see the example in the gist itself.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement