更新时间:2021-08-21 21:59:22
您可以为verify
选项提供必要的证书.
You can provide the necessary certificate to the verify
option.
jira-python
将Requests
用于HTTP (文档).
根据请求文档
您可以在verify
中指定证书文件的路径.
因此,您可以像这样在verify
中提供根证书:
According to Requests documentation
you can specify a path to a certificate file in verify
.
So you can provide the root certificate in verify
like so:
jira_options = {
'server': jira_server_name,
'verify': 'path/to/root/certificate',
}
因此,在您的情况下,请更改为:
So in your case just change to this:
jira = jira = JIRA(basic_auth=(un, pwd), options={'server': server,'verify': 'path/to/root/certificate',})
In Chrome for example you can show the certificate as described in this article
在Chrome中连接到服务器,然后单击地址栏左上角显示的锁,然后右键单击该锁(请参见下图),然后单击详细信息",然后单击查看证书".然后将此证书保存到文件中,并在verify
中进行引用.
Connect to your server in Chrome and click on the lock shown in the left-hand corner of address bar and right-click that lock (see image below), then click 'details', then 'view certificate'. Then save this cert to file and refer to it in verify
.
另一种方法(如下面的评论中的@Snow所述)是通过F12
打开开发工具,然后导航到安全性"选项卡.
Another way, as @Snow mentioned in the comments below, is to open the development-tools via F12
and then navigate to the Security tab.
从文档中
SSL CERT验证:
如果将verify设置为目录的路径,则必须已使用OpenSSL随附的c_rehash实用程序处理了该目录.
If verify is set to a path to a directory, the directory must have been processed using the c_rehash utility supplied with OpenSSL.
客户端证书:
本地证书的私钥必须未加密.当前,请求"不支持使用加密密钥.
The private key to your local certificate must be unencrypted. Currently, Requests does not support using encrypted keys.
还有设置'verify':false
的选项-不建议您这样做,因为关闭证书验证会使您容易受到
There's also the option to set 'verify':false
- thou it's not recommended since turning off certificate verification leaves you vulnerable for Man-in-the-Middle attacks.