1

我在 Postman 上运行 GET 并在 Status 200 下正常工作,但是当我从 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;……'

{"error":{"message":"Unauthorized"},"meta":{"triggered_action":null}}

4

1 回答 1

0

您发布的命令部分似乎没问题。

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

更新:

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

-H 'User-Agent: Mozilla' \

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

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

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

于 2020-04-20T14:52:18.637 回答