简体   繁体   中英

SSL Error while trying to access JIRA using Python

I am getting SSL Error while trying to access JIRA API from python application.

The error message reads -

requests.exceptions.SSLError: HTTPSConnectionPool(host='jira.companyurl.com', port=443): Max retries exceeded with url: /rest/api/2/serverInfo (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))

def oauth():
    key_cert_data = None
    with open('/scripts/jira_privatekey.pem', 'r') as key_cert_file:
        key_cert_data = key_cert_file.read()
    oauth_dict = {
                'access_token': 'XXXXXX',
                'access_token_secret': 'YYYYYY',
                'consumer_key': 'OauthKey',
                'key_cert': key_cert_data
            }
    return oauth_dict
url = 'https://jira.companyurl.com'



jira = JIRA(url, oauth=oauth())

could you please advise how to overcome this SSL error?

You can overcome this by passing verify=False :

def oauth():
    key_cert_data = None
    with open('/scripts/jira_privatekey.pem', 'r') as key_cert_file:
        key_cert_data = key_cert_file.read()
    oauth_dict = {
                'access_token': 'XXXXXX',
                'access_token_secret': 'YYYYYY',
                'consumer_key': 'OauthKey',
                'key_cert': key_cert_data
            }
    return oauth_dict
url = 'https://jira.companyurl.com'



jira = JIRA(url, oauth=oauth(), options={"verify": False})

As always in this case, please use this as a temporary override and not as in production since it can introduce security issues.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM