https-SSL请求

# coding:utf-8
import requests
# 禁用安全请求警告
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

url = "https://passport.cnblogs.com/user/signin"
headers = {
     "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0"
          }
r = requests.get(url, headers=headers, verify=False) # verify=False忽略对 SSL 证书的验证
print(r.status_code)

posted @ 2019-01-22 16:26  千年妖狐  阅读(243)  评论(0编辑  收藏  举报