GET请求适用于Postman,但不适用于终端机

时间:2020-04-20 11:17:04

标签: python curl terminal postman

我在Postman上运行GET并在Status 200 ok上运行良好,但是当我从Postman拾取代码并在Mac OS终端上运行Curl / Python时,它通过401错误运行,请您帮我解决问题。

curl --location --request GET'www.instacart.com/v3/containers/costco/next_gen/retailer_information/content/delivery?source=web'--header'Cookie:_instacart_logged_in = 1; build_sha = xxxxxxxxxxxxxx; signup_load_perf_date = xxxxxxxxxxxxxx;振幅_idundefinedinstacart.com = xxxxxxxxxxxxxx; _gcl_au = xxxxxxxxx; _fbp = fbxxxxxxxx; ......'

{“错误”:{“消息”:“未经授权”},“元”:{“触发动作”:空}}

1 个答案:

答案 0 :(得分:0)

您发布的命令部分似乎还可以。

也许您错过了其他标题? 考虑到cookie可能也会过期...

更新:

服务器可以禁止curl用户代理,因此请尝试添加

-H 'User-Agent: Mozilla' \

此外,邮递员可能会自动附加Content-Type标头,因此请尝试添加

-H 'Content-Type:application/json' \

另一件事是检查主机。尝试使用https://,也可以尝试使用/不使用www