Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,257,446
Community Members
 
Community Events
164
Community Groups

Python script fails with: [SSL: CERTIFICATE_VERIFY_FAILED]

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))

2 answers

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: ')

Unless you need encryted password.

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you