kennethreitz/requests — Issue #436: ValueError in generate_chunked (invalid literal for int())
Author: umbrae
Created: 2012-02-16 23:20:45+00:00
State: open

Looks like there's some trouble handling some specific URLs in the version 0.10.2 of requests:

```
>>> import requests
>>> requests.head('http://feeds.gawker.com/~r/jalopnik/full/~3/gaYrXc40sbA/this-is-the-worst-school-zone-sign-in-history')

[...wait a very long time...]

Traceback (most recent call last):
File "", line 1, in
File "/Users/umbrae/Envs/rdb/lib/python2.6/site-packages/requests/api.py", line 73, in head
return request('head', url, **kwargs)
File "/Users/umbrae/Envs/rdb/lib/python2.6/site-packages/requests/api.py", line 39, in request
return s.request(method=method, url=url, **kwargs)
File "/Users/umbrae/Envs/rdb/lib/python2.6/site-packages/requests/sessions.py", line 200, in request
r.send(prefetch=prefetch)
File "/Users/umbrae/Envs/rdb/lib/python2.6/site-packages/requests/models.py", line 557, in send
self._build_response(r)
File "/Users/umbrae/Envs/rdb/lib/python2.6/site-packages/requests/models.py", line 211, in _build_response
r.content # Consume socket so it can be released
File "/Users/umbrae/Envs/rdb/lib/python2.6/site-packages/requests/models.py", line 746, in content
self._content = bytes().join(self.iter_content()) or None
File "/Users/umbrae/Envs/rdb/lib/python2.6/site-packages/requests/models.py", line 676, in generate_chunked
pending_bytes = int(pending_bytes, 16)
ValueError: invalid literal for int() with base 16: ''
```

I can scrape up a few more test case URLs as well if you'd like.