python SSL处理
浏览器SSL提示
我们看一下IE的解决方案,对ie浏览器而言,需要添加Desired Capabilities的acceptSslCerts选项为True,代码如下: 的
112 / 166
#_*_ coding:utf-8 _*_
__author__ = '苦叶子'
from selenium import webdriver
if __name__ == '__main__':
capabilities = webdriver.DesiredCapabilities().INTERNETEXPLORER
capabilities['acceptSslCerts'] = True
driver = webdriver.Ie(capabilities=capabilities)
driver.get(u'https://cacert.org/')
print driver.title driver.quit()
对于firefox浏览器则需要添加FirefoxProfile()的accept_untrusted_certs的选项为True,示例代码如下:
#_*_ coding:utf-8 _*_
__author__ = '苦叶子'
from selenium import webdriver
if __name__ == '__main__':
profile=webdriver.FirefoxProfile()
profile.accept_untrusted_certs=True
driver=webdriver.Firefox(firefox_profile=profile)
113 / 166
driver.get(u'https://cacert.org/')
driver.close()
对于chrome浏览器则需要添加ChromeOptions()的--ignore-certificate-errors选项为True,示例代码如下:
#_*_ coding:utf-8 _*_
__author__ = '苦叶子'
from selenium import webdriver
if __name__ == '__main__':
options=webdriver.ChromeOptions() options.add_argument('--ignore-certificate-errors') driver=webdriver.Chrome(chrome_options=options) driver.get(u'https://cacert.org/') driver.close()
python SSL处理的更多相关文章
- Python‘ssl.match_hostname()’函数SSL证书验证安全绕过漏洞
漏洞名称: Python‘ssl.match_hostname()’函数SSL证书验证安全绕过漏洞 CNNVD编号: CNNVD-201312-033 发布时间: 2013-12-04 更新时间: 2 ...
- Python [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed 解决方法
一个搭建在SAE上的Django应用,使用新浪微博提供的Python SDK已经稳定运行一年有余,但最近开始持续出现微博认证失败的状况. 摘录微博python SDK的错误提示如下所示: ERROR: ...
- python SSL 错误
python 使用pip 安装模块是提示SSL错误 出现该问题的原因由于系统的openssl是1.0.1的版本,对于python3.7太老了,需要更新为openssl1.0.2或者libressl2. ...
- MacOS升级到Monterey后python SSL握手失败问题
MacOS升级到Monterey 12.0.1后,忽然发现原来工作正常的python3请求华为restconf API报错失败,提示 ssl.SSLError: [SSL: SSLV3_ALERT_H ...
- 2019-05-14 Python SSL
解决SSL报错问题 -- 导库 import ssl import urllib.request context = ssl._create_unverified_context() --用urlli ...
- ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?
官方已经给出解决方案:https://github.com/pyenv/pyenv/wiki/Common-build-problems#error-the-python-ssl-extension- ...
- Python爬虫连载7-cookie的保存与读取、SSL讲解
一.cookie的保存与读取 1.cookie的保存-FileCookie.Jar from urllib import request,parse from http import cookieja ...
- python虚拟环境的使用
一. 安装 sudo apt-get install python-virtualenv 二. 创建环境 sudo virtualenv Myenv 创建完全隔离的Python环境,实质是创建了一个文 ...
- python爬虫(五)_urllib2:Get请求和Post请求
本篇将介绍urllib2的Get和Post方法,更多内容请参考:python学习指南 urllib2默认只支持HTTP/HTTPS的GET和POST方法 urllib.urlencode() urll ...
随机推荐
- nginx 开启静态 gzip 配合 Vue 构建
在站点配置添加如下代码: location ~* \.(css|js)$ { gzip_static on; } 这是 nginx 的静态 gzip功能,会自动查找对应扩展名的文件,如果存在 gzip ...
- SpringTask定时任务的使用
实现定时任务简单的有四种方式:Timer\ScheduledThreadPool线程池\quartz(常用),还有另一种就是springtask. 都说springtask上手简单,于是简单的研究一下 ...
- 通过SecureCRT连接虚拟机
继续上一篇: http://www.cnblogs.com/CoolJayson/p/7430421.html 上一篇配置了虚拟机网络环境, 实际开发中通常使用SecureCRT或Xshell等连接L ...
- 【转】MySQL— 基础
[转]MySQL— 基础 目录 一.MySQL概述 二.下载安装 三.数据库操作 四.数据表操作 五.表内容操作 一.MySQL概述 MySQL是一个关系型数据库管理系统,由瑞典MySQL AB 公司 ...
- mac下安装memcache
需求包安装libmemcached brew install libmemcached 安装memcached brew install memcached 启动服务 brew services st ...
- ES6学习笔记五(promise异步)
知识点1:rosolve是执行下一步then() // Promise { let ajax=function(){ console.log('执行2'); return new Promise(fu ...
- 028_nginx_https证书
一. 事件经过 2017年3月份谷歌和火狐的调查人员发现赛门铁克打破了行业规则误签发127张SSL证书随着调查进一步开展发现误签发的证书数量达到惊人的3万多张. 这个数字震撼了业界专家因为赛门铁克是市 ...
- top 分析
Top命令监控某个进程的资源占有情况 下面是各种内存: VIRT:virtual memory usage 1.进程“需要的”虚拟内存大小,包括进程使用的库.代码.数据等 2.假如进程申请10 ...
- 【原创】大数据基础之Flume(2)kudu sink
kudu中的flume sink代码路径: https://github.com/apache/kudu/tree/master/java/kudu-flume-sink kudu-flume-sin ...
- Socket实现断线重连
客户端维护一个线程安全的待发送信息队列 开启死循环 判断Socket = null 调用Socket的sendUrgentData(0xFF)发送1个字节的心跳包 捕捉到连接异常后就关 ...