Hi all, I am currently trying to connect to Jira Server using the API and Python and I keep getting a couple of errors:
'HTTPConnectionPool(host='localhost', port=2990): Max retries exceeded with url: /jira/rest/api/2/serverInfo (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000014F6BEF1690>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))'
when I try to login with my token and
'HTTPSConnectionPool(host='jira.us.bank-dns.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:997)'
when I try with username and password.
I am using the following code to try and make the connection:
Could you try with below code and let me know if it works for you?
I have added 2 lines highlighted in bold and modified jira_options to include verify=False dict value.
from jira import JIRA
import urllib3
urlib3.disable_warnings()
jira_options = {'server': 'https://jira.<domain>', 'verify': False}
jira_user = '<username>'
jira_password = '<password>'
# Establish a connection to Jira
jira = JIRA(options=jira_options, basic_auth=(jira_user, jira_password))
# Define the new issue/ticket
issue_dict = {
'project': {'key': '<project_key>'}, # Replace with your project key
'summary': 'API Test',
'description': 'Detailed description of the issue',
'issuetype': {'name': 'Bug'} # Replace with the desired issue type
}
# Create the issue in Jira
new_issue = jira.create_issue(fields=issue_dict)
# Print the created issue's key
print(f"Created issue: {new_issue.key}")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.