【发布时间】:2017-07-28 16:12:21
【问题描述】:
我有一个简单的 python 3 脚本,它发送一个发布请求以删除 SonarQube 中的一个项目。当我不断进入我的 python 脚本时,一个简单的 curl 命令可以工作......知道我的 python 脚本有什么问题吗?
import requests
headers = {
'Authorization': 'Basic YWRtaW46YWRtaW4=',
}
files = [
('key', 'com.eclipseoptions.viewserver:viewserver:feature_VS-313-add-an-instruction-event-and-view'),
]
r = requests.post('http://devsonar/api/projects/delete', headers=headers, files=files)
print(r)
以下 curl 命令可以正常工作:
curl -X POST -H "Authorization: Basic YWRtaW46YWRtaW4=" -F "key=com.eclipseoptions.viewserver:viewserver:feature_VS-313-add-an-instruction-event-and-view" "http://devsonar/api/projects/delete"
【问题讨论】:
标签: python curl sonarqube python-requests