请求Python中的卷曲命令

时间:2016-10-20 18:24:07

标签: python curl python-requests

我正在尝试使用cURL库为Requests命令编写一个python等效脚本。我无法找到相关标志来禁用SSL验证并且不设置代理。

curl -v -k -T debug.zip https://url-to-no-ssl-server/index.aspx --noproxy url-to-no-ssl-server -X POST -H "filename: debug.zip"

如何将此命令转换为python-requests?

1 个答案:

答案 0 :(得分:0)

This SO Answer shows how to disable proxies:

session = requests.Session()
session.trust_env = False

The documentation for requests has disabling SSL verification:

Requests can also ignore verifying the SSL certificate if you set verify to False:

requests.get('https://kennethreitz.com', verify=False)
<Response [200]>

By default, verify is set to True. Option verify only applies to host certs.