Accessing Jira onDemand with Python

import jira.client
from jira.client import JIRA

options = {'server': ''}
jira = JIRA(options)    
authed_jira = JIRA(basic_auth=('username', 'password'))


I am trying to connect to my ondemand version of Jira using Python. I was abe to get requests module working, but it can't fully satisfy my needs. I tried the Jira Python module wih the cde written above, but all i get in return is this:

requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=2990): Max retries exceeded with url: /jira/rest/api/2/serverInfo (Caused by <class 'socket.error'>: [Errno 10061] No connection could be made because the target machine actively refused it)

The "Accept remote API calls" option is enabled in Jira Configuration. Could someone help with this please?

3 answers

1 accepted

5 votes
Accepted answer

I think that the problem is that you construct JIRA twice - once with url and once with auth, so the authed_jira is actually a JIRA instance pointing to http://localhost:2990/using basic auth.

You need to pass both the options containng the server addess and the basic_auth parameter

import jira.client
from jira.client import JIRA
options = {'server': ''}
jira = JIRA(options, basic_auth=('username', 'password'))

yes, that worked! Cheers:)

yep, that worked! Cheers:)

I have same problem...
can't work ?  This is so simple thing, but .....
I'm crying.....

import jira.client
from jira.client import JIRA 
options = {'server': ''}
jira = JIRA(options, basic_auth=('myname', 'mypassword'))



Traceback (most recent call last):
File "C:/Python/Python35_Workspace/", line 4, in <module>
jira = JIRA(options, basic_auth=('myname', 'mypassword'))
File "C:\Python\Python35\lib\site-packages\jira\", line 310, in __init__
si = self.server_info()
File "C:\Python\Python35\lib\site-packages\jira\", line 1764, in server_info
j = self._get_json('serverInfo')

Suggest an answer

Log in or Sign up to answer
Community showcase

Scrum Roles Explained: the Do's and the Don'ts

Hello Community,  Today we are going to talk about the three Scrum Roles. There is the Development Team, the Scrum Master and the Product Owner. In my opinion these three are all really impo...

69 views 0 4
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you