kennethreitz/requests — pull request #922 by drmaples (2012-10-30 21:22:23+00:00)
Title: raise_for_status should raise when status_code is None

r.raise_for_status and r.ok should not report success when response has wonky data. this occurs when you use grequests and the greenlet encounters problems (timeout, etc)

```python
import grequests
urls = [grequests.get('http://google.com/?q={}'.format(n), timeout=.001) for n in range(3)]
responses = grequests.map(urls, size=2)
print '# responses={}'.format(len(responses))
for r in responses:
print 'status_code={}; ok={}; error={}'.format(r.status_code, r.ok, r.error)
r.raise_for_status()
```

```
Traceback (most recent call last):
File "/Users/darrell/.virtualenvs/clarence/lib/python2.7/site-packages/gevent/greenlet.py", line 390, in run
result = self._run(*self.args, **self.kwargs)
File "/Users/darrell/.virtualenvs/clarence/lib/python2.7/site-packages/requests/models.py", line 631, in send
raise ConnectionError(sockerr)
ConnectionError: [Errno 65] No route to host
>(prefetch=True)> failed with ConnectionError

Traceback (most recent call last):
File "/Users/darrell/.virtualenvs/clarence/lib/python2.7/site-packages/gevent/greenlet.py", line 390, in run
result = self._run(*self.args, **self.kwargs)
File "/Users/darrell/.virtualenvs/clarence/lib/python2.7/site-packages/requests/models.py", line 631, in send
raise ConnectionError(sockerr)
ConnectionError: [Errno 65] No route to host
>(prefetch=True)> failed with ConnectionError

Traceback (most recent call last):
File "/Users/darrell/.virtualenvs/clarence/lib/python2.7/site-packages/gevent/greenlet.py", line 390, in run
result = self._run(*self.args, **self.kwargs)
File "/Users/darrell/.virtualenvs/clarence/lib/python2.7/site-packages/requests/models.py", line 631, in send
raise ConnectionError(sockerr)
ConnectionError: [Errno 65] No route to host
>(prefetch=True)> failed with ConnectionError

# responses=3
status_code=None; ok=True; error=None
status_code=None; ok=True; error=None
status_code=None; ok=True; error=None
```