pypa/pip — pull request #1145 by dstufft (2013-08-16 16:19:35+00:00)
Title: [WIP][Discussion] Use requests instead of urllib2

This is a work in progress and needs to be discussed prior to merge. The vendoring has made reading the diff harder than it could be but the first commit 44c874c does nothing but vendor the code so you can just ignore that one.

This approach needed to write our own transport adapter to handle ``file://`` urls because requests does not handle them by default. However this transport adapter is overall pretty small.

#### Tasks

* [ ] Handle Basic Auth
* [ ] Hande --no-input
* [ ] Ensure PIP_CERT still works
* [ ] Ensure proxy support still works
* [ ] Ensure timeout still works
* [ ] Add in high level tests ensuring TLS is functioning
* [ ] Add Tests for what we can

#### Benefits

* Reduces maintenance burden
* No more low level HTTP code
* Centralizes HTTPS verification to the requests library
* Optional support for SNI - Requires installing other packages
* Keep Alive Support & Pooled Network Connections
* Better tested code handling HTTP
* Opportunity for further simplification of code
* PageCache can possibly be moved to a generic requests level cache
* Thread Pool can possibly be moved to a generic requests async method

#### Risks

The primary risk is regression. This will shift the primary driver of all of our network communication from urllib2 over to requests. This area of code is not well tested and there could be subtle differences in behavior that testing will not expose.