kennethreitz/requests — pull request #548 by umbrae (2012-04-12 16:39:18+00:00)
Title: A get with an invalid port should wrap urllib3's LocationParseError exception with our own.

Fixes this issue:

```python
>>> import requests
>>> requests.get('http://google.com:banana')
Traceback (most recent call last):
File "", line 1, in
File "/Users/umbrae/Envs/rdb/lib/python2.6/site-packages/requests/api.py", line 51, in get
return request('get', url, **kwargs)
[...snip...]
File "/Users/umbrae/Envs/rdb/lib/python2.6/site-packages/requests/packages/urllib3/connectionpool.py", line 579, in get_host
raise LocationParseError("Failed to parse: %s")
requests.packages.urllib3.exceptions.LocationParseError: (LocationParseError(...), 'Failed to parse: Failed to parse: %s')
```

To now return a wrapped exception, which hides the use of urllib3 and is more intuitive to catch:

```python
>>> import requests
re>>> requests.get('http://google.com:banana')
Traceback (most recent call last):
File "", line 1, in
File "requests/api.py", line 52, in get
return request('get', url, **kwargs)
File "requests/api.py", line 40, in request
return s.request(method=method, url=url, **kwargs)
File "requests/sessions.py", line 208, in request
r.send(prefetch=prefetch)
File "requests/models.py", line 506, in send
raise InvalidURL(e)
requests.exceptions.InvalidURL: (LocationParseError(...), 'Failed to parse: Failed to parse: google.com')
```