kennethreitz/requests — pull request #1109 by jvantuyl (2013-01-18 03:15:57+00:00)
Title: add file scheme support

Adds file://... support. It's unnaturally complete for what it does.

* methods for GET / HEAD / PUT / POST / DELETE
* turns symlinks into redirects
* appropriate HTTP errors for access-denied, missing file, etc.
* streaming support for large files
* guesses content-types / encodings from filenames
* date, last-modified, content-length, and other headers

Since this is potentially dangerous, it's not enabled by default. A few
rudimentary tests are provided.

For those who are wondering why anyone would want this, I use it for
bootstrapping some of our HTTP clients (i.e. I have a list of URLs for
fall-back, with a file://... URL at the end) and of testing (i.e. it's easier
to just change the API base URI to file: than it is to mock out requests
everywhere).