Python Jira: Keberos authentication

Joel König December 18, 2018

Hi Guys,

I trying to write a python script, that creates an epic according to user inpunt and other conditions. First of all, please excuse, im completely new to python and scripting. So, if my question is stupid, you know why :D...

 

Now im facing the following issue:

 

from jira import JIRA

jira = JIRA('https://jira.domain.com', kerberos=True)

Traceback (most recent call last):
File "<stdin>", line 6, in <module>
File "C:\Python\lib\site-packages\jira\client.py", line 472, in __init__
si = self.server_info()
File "C:\Python\lib\site-packages\jira\client.py", line 2133, in server_info
j = self._get_json('serverInfo')
File "C:\Python\lib\site-packages\jira\client.py", line 2549, in _get_json
r = self._session.get(url, params=params)
File "C:\Python\lib\site-packages\jira\resilientsession.py", line 151, in get
return self.__verb('GET', url, **kwargs)
File "C:\Python\lib\site-packages\jira\resilientsession.py", line 125, in __verb
response = method(url, timeout=self.timeout, **kwargs)
File "C:\Python\lib\site-packages\requests\sessions.py", line 546, in get
return self.request('GET', url, **kwargs)
File "C:\Python\lib\site-packages\requests\sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "C:\Python\lib\site-packages\requests\sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "C:\Python\lib\site-packages\requests\adapters.py", line 412, in send
conn = self.get_connection(request.url, proxies)
File "C:\Python\lib\site-packages\requests\adapters.py", line 307, in get_connection
raise InvalidProxyURL("Please check proxy URL. It is malformed"
requests.exceptions.InvalidProxyURL: Please check proxy URL. It is malformed and could be missing the host.


 

From the error message, i can read that the proxy url is invalid. Is there a way to force python to use the system settings or is it possible to set the proxy URL?

 

Thanks in advance,
Joel

2 answers

0 votes
Gonchik Tsymzhitov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 21, 2021

I used previously the old package.

 

Now investigating the new one 

https://github.com/atlassian-api/atlassian-python-api/pull/692

If you have opinion feel free to add the comment into discussion, please

0 votes
Joel König December 18, 2018

I've managed to get rid of the invalid proxy url error message. Now i receive the following error message:

 

>>> issue = jira.issue('SIM-301')
WARNING:root:Got recoverable error from GET https://jira.domain.com/rest/api/2/issue/SIM-301, will retry [1/3] in 15.109584678861232s. Err: 401
WARNING:root:Got recoverable error from GET https://jira.domain.com/rest/api/2/issue/SIM-301, will retry [2/3] in 38.27272501512549s. Err: 401
WARNING:root:Got recoverable error from GET https://jira.domain.com/rest/api/2/issue/SIM-301, will retry [3/3] in 55.68274007670974s. Err: 401
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python\lib\site-packages\jira\client.py", line 1071, in issue
issue.find(id, params=params)
File "C:\Python\lib\site-packages\jira\resources.py", line 201, in find
self._load(url, params=params)
File "C:\Python\lib\site-packages\jira\resources.py", line 316, in _load
r = self._session.get(url, headers=headers, params=params)
File "C:\Python\lib\site-packages\jira\resilientsession.py", line 151, in get
return self.__verb('GET', url, **kwargs)
File "C:\Python\lib\site-packages\jira\resilientsession.py", line 147, in __verb
raise_on_error(response, verb=verb, **kwargs)
File "C:\Python\lib\site-packages\jira\resilientsession.py", line 57, in raise_on_error
r.status_code, error, r.url, request=request, response=r, **kwargs)
jira.exceptions.JIRAError: JiraError HTTP 401 url: https://jira.domain.com/rest/api/2/issue/SIM-301
text: You do not have the permission to see the specified issue.

response headers = {'X-AREQUESTID': '864x4271312x1', 'X-ANODEID': 'jira-rest', 'X-XSS-Protection': '1; mode=block', 'X-Content-Type-Options': 'nosniff', 'X-Frame-Options': 'SAMEORIGIN', 'Content-Security-Policy': "frame-ancestors 'self'", 'X-ASEN': 'SEN-10760404', 'X-AUSERNAME': 'anonymous', 'Cache-Control': 'no-cache, no-store, no-transform', 'WWW-Authenticate': 'OAuth realm="https%3A%2F%2Fjira.domain.com"', 'Content-Type': 'application/json;charset=UTF-8', 'Transfer-Encoding': 'chunked', 'Date': 'Tue, 18 Dec 2018 13:24:43 GMT'}
response text = {"errorMessages":["You do not have the permission to see the specified issue.","Login Required"],"errors":{}}  

 

What do i need to do, in order to authenticate to jira through kerberos?

Suggest an answer

Log in or Sign up to answer