HTTPResponse object has no attribute 'chunked'
评估
调研方向
从 traceback 中显示的 response.chunked 访问处开始检查 cachecontrol/adapter.py,然后使用报告中的 Python、requests、CacheControl 和 requests-cache 版本重现该问题。检查相关的 response 兼容性和现有测试;完成的标准是请求不再引发 AttributeError,并且该回归问题已由测试覆盖。
由索引模型根据 Issue 内容生成。
描述
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'
- 主要语言
- Python
- 星标
- 505
- 派生
- 153
- 平均合并
- 5 天 6 小时
- 30 天内合并 PR
- 5
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
psf/cachecontrol 的其他 Issue
-
Cache Deserialization (part two) -- warning message incorrect?可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 65/100
psf/cachecontrol#209 · 5 条评论 ·
-
Race condition in send()可能已有人在做 @JulienPalard 于 147 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 45/100
psf/cachecontrol#424 · 1 条评论 ·
-
HTTP 302 Found responses with Cache Headers not being cached可能已有人在做 @cburroughs 于 280 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 42/100
psf/cachecontrol#384 · 18 条评论 ·
-
Head request is not cached even with cacheable_methods=("GET", HEAD") without a previous GET可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 3/5 1-2 天 新手友好度 35/100
psf/cachecontrol#337 · 6 条评论 ·
-
Investigate failure to load caches above `2^32 - 1` bytes可能重新可做 @woodruffw 于 853 天前认领,目前没有进行中的 PR。 未关闭
psf/cachecontrol#336 · 4 条评论 · 1 个 reaction · 已指派 1 人 ·
相似的 Issue
-
Atomic append fails to create a missing file可能已有人在做 @harbinresearcher 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
fabiocaccamo/python-fsutil#201 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
task
难度 2/5 1-3 小时 新手友好度 78/100
danparshall/claude_researcher#87 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 62/100
GhostManager/Ghostwriter#998 · 1 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 85/100
datajoint/datajoint-python#1586 ·
维护者通常 1 天内回复