SOCKS Proxy Support

This pull request _finally_ adds SOCKS proxy support to the Requests module, pretty much four years _to the day_ since we were first asked (in #324 for those who want to follow it).

This pull request relies on a pull request I have opened against urllib3, so we can't land it until urllib3 1.14.1 is released containing that code. However, once that's done this PR should be ready to rock.

I'm setting this up for the 2.10.0 milestone as I see no reason to wait for 3.0.0 for SOCKS support.

Resolves #324, #723, #1147, #1982, #2156, #2425, and #2562.


:pray: 


:+1: on the code and :+1: on the milestone.


@Lukasa what do you think about having a `socks` extra for requests that installs `PySocks` and whatever else?


Done. =)


Does PySocks require any compilation during installation? We should consider vendoring it if we want to consider this an actual feature of Requests. 


PySocks requires no compilation. However, we'll have to rewrite import paths in urllib3 if you want to vendor PySocks.


Well, if it's going to be used by a very small subset of users (likely the case), it's likely fine to leave it as an optional dependency.

We could pack it in without modifying urllib3's code, technically:

(`packages/__init__.py`)

``` python
try:
    from . import socks
    sys.modules['socks'] = socks
except ImportError:
    try:
        import socks
    except ImportError:
        pass
```

This is obviously not the best idea, but it does function properly. 


Mucking with sys.modules in the past has caused us enough headaches that I'd rather not go too far down that path again


I don't disagree :)


@Lukasa is this was merged or not? Btw, how to configure the socks proxy?


This has not been merged.

When it is released, you can configure the socks proxy as you would configure other proxies: `proxies={'http': 'socks5://localhost:8888/'}`, for example.


@Lukasa so it should work like

``` python
#proxy
        # SOCKS5 proxy for HTTP/HTTPS
        proxies = {
            'http' : "socks5://myproxy:9191",
            'https' : "socks5://myproxy:9191"
        }

        #headers
        headers = {

        }

        url='http://icanhazip.com/'
        res = requests.get(url, headers=headers, proxies=proxies)
```


Correct. Of course, that won't work unless you use a patched version of requests that contains both this patch _and_ an updated urllib3, _and_ you install the appropriate optional dependencies.


@Lukasa uhm, so supposed to use on google appengine, I have to wait the `devappserver2` python sdk update...


On GAE I suspect using a SOCKS proxy is going to take a while. I should also note that to use a SOCKS proxy on GAE will require that you enable socket support, which as I understand it is substantially more expensive than simply using the standard httplib replacement.


btw, In the meanwhile I'm doing

``` shell
>>> import requesocks
>>> import requests
>>> session = requesocks.session()
>>> session.proxies = {
...     'http' : "socks5://myproxy.net:9050",
...     'https' : "socks5://smyproxy.net:9050"
... }
>>> url='http://icanhazip.com/'
>>> resp = requests.get(url)
>>> resp
<Response [200]>
>>> resp.text
u'89.97.90.230\n'
>>> resp.text.strip()
u'89.97.90.230'
>>> resp = session.get(url)
>>> resp.text.strip()
u'171.25.193.78'
>>> 
```

that in most envs will work ( a part again appengine that lacks of `pwd` support 😡


Is this done? Let's merge it if so. 


We need an updated urllib3. I think @shazow is expecting to release this week.


Released!


Sweet, let's do it. 


We'll include it in the next release, which can therefore happen this week (or even today).


@kennethreitz I'm away from my laptop, so if you're in a merging mood you can land the urllib3 update and then merge this.

Please note that it makes everyone's life easier if you merge in urllib3 directly from the brand new tag (1.15). Just a suggestion!


The anticipation is killing me.


What's [WIP] about this? Previous comments seem to suggest it's done, just waiting for the release.

(Also, referencing https://github.com/shazow/urllib3/pull/762 and #478)


:sparkles: :cake: :sparkles:


![DJ Khaled](https://media.giphy.com/media/RDbZGZ3O0UmL6/giphy.gif)


Released, announced.