Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Python script fails with: [SSL: CERTIFICATE_VERIFY_FAILED]

John_Dumbar June 18, 2020 edited

Python: 3.8
Jira module: jira-2.0.0-py2.py3-none-any.whl

This is my python script:

from jira.client import JIRA
import getpass

passwd = getpass.getpass('Password: ')

jira = JIRA(options = {'server': 'https://jira.example.com'}, basic_auth=('username', passwd))

And the output is:

WARNING:root:HTTPSConnectionPool(host='jira.example.com', port=443): Max retries exceeded with url: /rest/api/2/serverInfo (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)'))) while doing GET https://jira.example.com/rest/api/2/serverInfo [{'params': None, 'headers': {'User-Agent': 'python-requests/2.24.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json,*.*;q=0.9', 'Connection': 'keep-alive', 'Cache-Control': 'no-cache', 'Content-Type': 'application/json', 'X-Atlassian-Token': 'no-check'}}]
WARNING:root:Got ConnectionError [HTTPSConnectionPool(host='jira.example.com', port=443): Max retries exceeded with url: /rest/api/2/serverInfo (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)')))] errno:None on GET https://jira.example.com/rest/api/2/serverInfo
{'response': None, 'request': <PreparedRequest [GET]>}\{'response': None, 'request': <PreparedRequest [GET]>}
WARNING:root:Got recoverable error from GET https://jira.example.com/rest/api/2/serverInfo, will retry [1/3] in 15.590765967470047s. Err: HTTPSConnectionPool(host='jira.example.com', port=443): Max retries exceeded with url: /rest/api/2/serverInfo (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)')))

...

This issue has been solved with the following modification to code:

import jira.client
from jira import JIRA
import getpass
import urllib3
urllib3.disable_warnings()

passwd = getpass.getpass("Password: ")
jira = JIRA(options = {'server': 'https://jira.example.com', 'verify': False}, basic_auth=('username', passwd))

3 answers

5 votes
Krishna Teja Medam
Contributor
April 2, 2021 edited

I am NOT sure if you still need answer but I found an answer just now. Just install "python-certifi-win32" and boom, certification error is cleared.

"Server" should be outside of "options" and NO need for 

import getpass

passwd = getpass.getpass('Password: ')
Krishna Teja Medam
Contributor
April 2, 2021

Unless you need encryted password.

sosiker January 24, 2022
afroz_ khan June 26, 2022

Hello, 

I am also getting same issue while executing the script. My OS and python version is:

Python2.7

CentOS 7.9

I added the certificate in the script for the verification which is required and cant disable it (False)

i tested the script with Python3.6 but the issue is still same.

/usr/lib/python2.7/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.24.1) or chardet (2.2.1) doesn't match a supported version!  (The error was fixed in Python3.6)
RequestsDependencyWarning)
WARNING:root:HTTPSConnectionPool(host='jira.example.com', port=443): Max retries exceeded with url: /rest/api/2/serverInfo (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:618)'),)) while doing GET https://jira.example.com/rest/api/2/serverInfo [{u'headers': {'Accept-Encoding': 'gzip, deflate', u'Accept': u'application/json,*.*;q=0.9', 'User-Agent': 'python-requests/2.21.0', 'Connection': 'keep-alive', u'X-Atlassian-Token': u'no-check', u'Cache-Control': u'no-cache', u'Content-Type': u'application/json'}, 'params': None}]
WARNING:root:Got ConnectionError [HTTPSConnectionPool(host='jira.example.com', port=443): Max retries exceeded with url: /rest/api/2/serverInfo (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:618)'),))] errno:None on GET https://jira.example.com/rest/api/2/serverInfo
{'request': <PreparedRequest [GET]>, 'response': None}\{'request': <PreparedRequest [GET]>, 'response': None}
WARNING:root:Got recoverable error from GET https://jira.example.com/rest/api/2/serverInfo, will retry [1/3] in 17.5623017522s. Err: HTTPSConnectionPool(host='jira.example.com', port=443): Max retries exceeded with url: /rest/api/2/serverInfo (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:618)'),))
WARNING:root:HTTPSConnectionPool(host='jira.example.com', port=443): Max retries exceeded with url: /rest/api/2/serverInfo (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:618)'),)) while doing GET https://jira.example.com/rest/api/2/serverInfo [{u'headers': {'Accept-Encoding': 'gzip, deflate', u'Accept': u'application/json,*.*;q=0.9', 'User-Agent': 'python-requests/2.21.0', 'Connection': 'keep-alive', u'X-Atlassian-Token': u'no-check', u'Cache-Control': u'no-cache', u'Content-Type': u'application/json'}, 'params': None}]
WARNING:root:Got ConnectionError [HTTPSConnectionPool(host='jira.example.com', port=443): Max retries exceeded with url: /rest/api/2/serverInfo (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:618)'),))] errno:None on GET https://jira.example.com/rest/api/2/serverInfo
{'request': <PreparedRequest [GET]>, 'response': None}\{'request': <PreparedRequest [GET]>, 'response': None}
WARNING:root:Got recoverable error from GET https://jira.example.com/rest/api/2/serverInfo, will retry [2/3] in 7.00724261109s. Err: HTTPSConnectionPool(host='jira.example.com', port=443): Max retries exceeded with url: /rest/api/2/serverInfo (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:618)'),))
WARNING:root:HTTPSConnectionPool(host='jira.example.com', port=443): Max retries exceeded with url: /rest/api/2/serverInfo (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:618)'),)) while doing GET https://jira.example.com/rest/api/2/serverInfo [{u'headers': {'Accept-Encoding': 'gzip, deflate', u'Accept': u'application/json,*.*;q=0.9', 'User-Agent': 'python-requests/2.21.0', 'Connection': 'keep-alive', u'X-Atlassian-Token': u'no-check', u'Cache-Control': u'no-cache', u'Content-Type': u'application/json'}, 'params': None}]
WARNING:root:Got ConnectionError [HTTPSConnectionPool(host='jira.example.com', port=443): Max retries exceeded with url: /rest/api/2/serverInfo (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:618)'),))] errno:None on GET https://jira.example.com/rest/api/2/serverInfo
{'request': <PreparedRequest [GET]>, 'response': None}\{'request': <PreparedRequest [GET]>, 'response': None}
WARNING:root:Got recoverable error from GET https://jira.example.com/rest/api/2/serverInfo, will retry [3/3] in 48.7617246555s. Err: HTTPSConnectionPool(host='jira.example.com', port=443): Max retries exceeded with url: /rest/api/2/serverInfo (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:618)'),))
WARNING:root:HTTPSConnectionPool(host='jira.example.com', port=443): Max retries exceeded with url: /rest/api/2/serverInfo (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:618)'),)) while doing GET https://jira.example.com/rest/api/2/serverInfo [{u'headers': {'Accept-Encoding': 'gzip, deflate', u'Accept': u'application/json,*.*;q=0.9', 'User-Agent': 'python-requests/2.21.0', 'Connection': 'keep-alive', u'X-Atlassian-Token': u'no-check', u'Cache-Control': u'no-cache', u'Content-Type': u'application/json'}, 'params': None}]
Traceback (most recent call last):
File "/scripts/jirapi.py", line 70, in <module>
createissue(importfile=args.file)
File "/scripts/jirapi.py", line 31, in createissue
jira = JIRA(jira_options, basic_auth=('api',pw))
File "/usr/lib/python2.7/site-packages/jira/client.py", line 472, in __init__
si = self.server_info()
File "/usr/lib/python2.7/site-packages/jira/client.py", line 2133, in server_info
j = self._get_json('serverInfo')
File "/usr/lib/python2.7/site-packages/jira/client.py", line 2549, in _get_json
r = self._session.get(url, params=params)
File "/usr/lib/python2.7/site-packages/jira/resilientsession.py", line 151, in get
return self.__verb('GET', url, **kwargs)
File "/usr/lib/python2.7/site-packages/jira/resilientsession.py", line 146, in __verb
raise exception
requests.exceptions.SSLError: HTTPSConnectionPool(host='jira.smar.ericsson.se', port=443): Max retries exceeded with url: /rest/api/2/serverInfo (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:618)'),))

Like • CAIO MANOEL COSTA LEONARDO likes this
Joydeep Guha
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 19, 2024

hi @Krishna Teja Medam how can we do the same with API token authentication ?

pruthviraj
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 3, 2024

Yes,
I have used it for Confluence Reader 
it required me to `pip install pip-system-certs`

 

from llama_index.readers.confluence import ConfluenceReader
reader = ConfluenceReader(base_url="<your instance url>", api_token ='<your token>')

documents = reader.load_data(

    space_key=space_key, include_attachments=True, page_status="current"

)

 

0 votes
Yi Meng
Contributor
January 7, 2025

I'm working on Jira Cloud. It was working fine before. But I encounter this issue this morning when I try the same python code before. 

It throws error

requests.exceptions.SSLError: HTTPSConnectionPool

SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1018)')

 

Any suggestions?

Yi Meng
Contributor
January 10, 2025

Update:

I have tried the same python code at home with VPN enabled. It works fine. 

So, I assume this would happen when you're in the org intranet behind a firewall? If this is the case, I guess only security team can solve the issue.

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, atlassian community, loom ai, atlassian loom ai, loom, atlassian ai, record recaps of meetings, meeting recaps, loom recaps, share meeting recaps,

Loom’s guide to great meetings 📹

Join us to learn how your team can stay fully engaged in meetings without worrying about writing everything down. Dive into Loom's newest feature, Loom AI for meetings, which automatically takes notes and tracks action items.

Register today!
AUG Leaders

Atlassian Community Events