小编lby*_*lby的帖子

GET 请求适用于邮递员,但不适用于 python 请求和curl

我尝试在 python 中创建到该站点的特定 GET 请求: https: //sgfm.elcorteingles.es/SGFM/dctm/MEDIA03/202006/24/00117731276964____5__210x210.jpg

但我没有得到浏览器的任何响应,它一直在等待。然后我尝试创建一个curl请求,同样的事情发生了(永远等待)。毕竟,我尝试创建一个 POSTMAN 请求,它工作完美!我不明白为什么它可以与邮递员一起使用,但不能与 python 和curl 一起使用,因为所有这些平台都不像浏览器。我使用postman方法将postman请求转换为python和curl:

#python
import requests

url = "https://sgfm.elcorteingles.es/SGFM/dctm/MEDIA03/202006/24/00117731276964____5__210x210.jpg"

payload = {}
headers= {}

response = requests.request("GET", url, headers=headers, json = payload)

print(response.text.encode('utf8'))

Run Code Online (Sandbox Code Playgroud)
#curl

curl --location --request GET 'https://sgfm.elcorteingles.es/SGFM/dctm/MEDIA03/202006/24/00117731276964____5__210x210.jpg'
Run Code Online (Sandbox Code Playgroud)

但他们都没有得到任何回应。有谁知道为什么会发生这种情况并将其转换为 python 请求?甚至卷曲我也可以处理。

python curl urllib python-requests postman

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

curl ×1

postman ×1

python ×1

python-requests ×1

urllib ×1