可以通过Postman发送PUT请求,但不能通过我的Python代码

时间:2017-05-22 09:33:10

标签: python api cloudfoundry postman

我正在尝试使用Cloud Foundry应用程序创建容器。当我通过Postman使用适当的正文和标题向https:// v2 / service_instances / temp-container发出请求时,响应是201创建的。

  

PUT / v2 / service_instances / temp-container HTTP / 1.1“201 228 22” - “”Mozilla / 5.0(Windows NT 10.0; Win64; x64)AppleWebKit / 537.36(KHTML,与Gecko一样)Chrome / 58.0.3029.110 Safari /537.36“”192.168.0.126:44484“”10.1.7.79:61612“x_forwarded_for:”155.56.68.219,192.168.0.126“x_forwarded_proto:”https“vcap_request_id:”2636e175-fbd5-42cb-6702-5a3bc96fb07e“response_time:0.213657225 app_id :“a1be4fad-c464-456b-8b7e-792da41ec93a”app_index:“1”x_b3_traceid:“126af56ae8190efa”x_b3_spanid:“126af56ae8190efa”x_b3_parentspanid:“ - ”

但是当我通过我的Python代码发出相同的请求时,我获得了401 Unauthorized。

  

“PUT / v2 / service_instances / temp-container HTTP / 1.1”401 228 177“ - ”“python-requests / 2.13.0”“192.168.0.126:49746”“10.2.7.81:64368”x_forwarded_for:“155.56 .68.219,192.168.0.126“x_forwarded_proto:”https“vcap_request_id:”85e50f55-4852-4150-7b62-c6d7ccb41e8d“response_time:0.025489445 app_id:”a1be4fad-c464-456b-8b7e-792da41ec93a“app_index:”2“x_b3_traceid:”​​5beaa4c44c4b9b4f “x_b3_spanid:”5beaa4c44c4b9b4f“x_b3_parentspanid:” - “

我得到的信息是

  

访问此资源需要完全身份验证

我确信我在两种情况下都使用相同的参数并发送相同的请求。可能的原因是什么?

0 个答案:

没有答案
相关问题