python requests发送HTTPS 请求-不验SSL证书

来源:互联网 发布:java电商项目介绍 编辑:程序博客网 时间:2024/04/25 18:24


有时为了方便,在发送请求时把验SSL证书关掉, 设置verify为False,


import requests
from requests import Request, Session

for i in range (0,2):
  s=requests.Session()
  r1= s.get('https://www.baidu.com/&', verify=False)
  print r1



====

/usr/local/python-2.7/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py:821: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)
/usr/local/python-2.7/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py:821: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)
<Response [200]>




-------------

聊聊生活,谈谈趣事

http://blog.sina.com.cn/tenderstone 


0 0
原创粉丝点击