如何在python 3中发出https请求

时间:2018-02-06 11:33:53

标签: python python-requests

我想使用https协议从我的服务器下载文件。我该怎么做呢? 这是我用http

的基本代码
response=requests.get('http://url',stream='True')

handle=open('dest_file.txt','wb')
for chunk in response.iter_content(chunk_size=512):
    if chunk:  # filter out keep-alive new chunks
        handle.write(chunk)

handle.close()  

请求模块也可以用于https吗?

1 个答案:

答案 0 :(得分:4)

根据http://docs.python-requests.org/en/master/user/advanced/#ssl-cert-verification

+----------+-----------+-----------+
|        ID|  Procedure|       Date|
|  30794324|         32| 2014-06-21|
|  30794324|         14| 2014-04-25|
+----------+-----------+-----------+