请求图像返回403响应

2024-10-01 09:33:01 发布

您现在位置:Python中文网/ 问答频道 /正文

我请求一个Image,它返回403响应。我尝试使用我的用户代理和其他代理,但仍然返回403。我知道有可能得到这张图片,因为tachiyomi使用webscraper获得他们的图片。目前我的代码如下所示:

headers = {"User-Agent": "a user agent"}
res= requests.get("https://s5.mkklcdnv6tempv3.com/mangakakalot/r1/read_bleach_manga_online_for_free2/chapter_673_father/1.jpg", headers=headers)
print(res.status_code)

我请求图像的方式是错误的吗?或者我是否应该添加其他参数/标题

解决方案:

而不是像头那样使用用户代理

headers = {"Referer": "https://mangakakalot.com/"}

Source


Tags: 代码用户httpsimagecom代理图片res