psf / psf/cachecontrol

HTTPResponse object has no attribute 'chunked'

Open
#137 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
505
Forks
149
Avg merge
2d 13h
Merged PRs (30d)
7

Description

Is this a known issue? Any workarounds?

> pip freeze | grep -i cache
CacheControl==0.11.7
requests-cache==0.4.13
> pip freeze | grep -i requests
requests==2.6.0
requests-cache==0.4.13
 # python
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> from cachecontrol import CacheControl
>>> sess = requests.session()
>>> cached_sess = CacheControl(sess)
>>> response = cached_sess.get('http://google.com')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/apps/python/local/lib/python2.7/site-packages/requests/sessions.py", line 476, in get
    return self.request('GET', url, **kwargs)
  File "/apps/python/local/lib/python2.7/site-packages/requests/sessions.py", line 464, in request
    resp = self.send(prep, **send_kwargs)
  File "/apps/python/local/lib/python2.7/site-packages/requests/sessions.py", line 602, in send
    history = [resp for resp in gen] if allow_redirects else []
  File "/apps/python/local/lib/python2.7/site-packages/requests/sessions.py", line 195, in resolve_redirects
    allow_redirects=False,
  File "/apps/python/local/lib/python2.7/site-packages/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/apps/python/local/lib/python2.7/site-packages/cachecontrol/adapter.py", line 47, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "/apps/python/local/lib/python2.7/site-packages/requests/adapters.py", line 437, in send
    return self.build_response(request, resp)
  File "/apps/python/local/lib/python2.7/site-packages/cachecontrol/adapter.py", line 100, in build_response
    if response.chunked:
AttributeError: 'HTTPResponse' object has no attribute 'chunked'

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with cachecontrol/adapter.py at the response.chunked access shown in the traceback, then reproduce the issue using the reported Python, requests, CacheControl, and requests-cache versions. Check the relevant response compatibility and existing tests; done means the request no longer raises AttributeError and the regression is covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.