Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Accessing Jira onDemand with Python

Yanis Vaks April 29, 2014
import jira.client
from jira.client import JIRA

options = {'server': 'https://address.atlassian.net'}
jira = JIRA(options)    
authed_jira = JIRA(basic_auth=('username', 'password'))

Hi,

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

6 votes
Answer accepted
Boris Georgiev _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 29, 2014

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': 'https://address.atlassian.net'}
jira = JIRA(options, basic_auth=('username', 'password'))

Yanis Vaks April 29, 2014

yes, that worked! Cheers:)

0 votes
Oracle Angel February 6, 2017

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': 'http://192.168.1.99:8080'}
jira = JIRA(options, basic_auth=('myname', 'mypassword'))

 

#----[error]------------

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

0 votes
Yanis Vaks April 29, 2014

yep, that worked! Cheers:)

TAGS
AUG Leaders

Atlassian Community Events