Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

HTTPResponse object has no attribute 'chunked'

未关闭
#137 8 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

@elnuno 已经在做这个了。

开始于 2017年4月11日。

  • #151 来自 @elnuno —— 未关闭
  • #436 来自 @princ0301 —— 已关闭,未合并

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
python
领域
api, backend

调研方向

从 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 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

psf/cachecontrol 的其他 Issue

查看 psf/cachecontrol 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。