目 录CONTENT

文章目录

requests.exceptions.InvalidHeader Invalid return character or leading space in header Cache-Control

大T
2022-05-09 / 0 评论 / 0 点赞 / 49 阅读 / 0 字

requests.exceptions.InvalidHeader  Invalid return character or leading space in header  Cache-Control

错误描述

File "D:\MyDevTools\PCrawler\venv\lib\site-packages\requests\utils.py", line 1025, in check_header_validity

raise InvalidHeader("Invalid return character or leading space in header: %s" % name)

requests.exceptions.InvalidHeader: Invalid return character or leading space in header: Cache-Control

image

引起原因

根据提示检查请求头Cache-Control,发现带有空格

image

解决办法

删掉空格。

image

0

评论区