Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can't authenticate Jira Server REST API through proxy server using Python

Andrey Kolesnikov March 27, 2019

Having trouble authenticating with JIRA Server over a virtual machine because of my company's proxy settings.

Here's the part of the script that breaks

jira_options={'server': 'https://jira.domain.com'}

oauth_dict = {
'access_token': access_token,
'access_token_secret': access_token_secret,
'consumer_key': consumer_key,
'key_cert': key_cert_data
}

jira = JIRA(options=jira_options, oauth=oauth_dict)

 

Error message:  

[2019-03-27 15:03:23,907] {bash_operator.py:94} INFO - WARNING:root:HTTPSConnectionPool(host='jira.domain.com', port=443): Max retries exceeded with url: /rest/api/2/serverInfo (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f6e45ca5898>: Failed to establish a new connection: [Errno 110] Connection timed out',)) while doing GET https://jira.domain.com/rest/api/2/serverInfo [{'params': None, 'headers': {'User-Agent': 'python-requests/2.18.4', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json,*.*;q=0.9', 'Connection': 'keep-alive', 'Cache-Control': 'no-cache', 'Content-Type': 'application/json', 'X-Atlassian-Token': 'no-check'}}]
[2019-03-27 15:03:23,907] {bash_operator.py:94} INFO - WARNING:root:Got ConnectionError [HTTPSConnectionPool(host='jira.domain.com', port=443): Max retries exceeded with url: /rest/api/2/serverInfo (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f6e45ca5898>: Failed to establish a new connection: [Errno 110] Connection timed out',))] errno:None on GET https://jira.domain.com/rest/api/2/serverInfo

 

I am able to run this code locally without issue an I have also tested a version of this script in cURL which works as expected, though this doesn't meet security standards because it's using simple authentication.

curl --noproxy “*” -o /usr/local/airflow/data/jira_input.json -D- -u ‘+jira_client_email+‘:’+jira_client_key+' -X GET -H “Content-Type: application/json” “https://jira.domain.com/rest/api/2/search?jql=project=CC&updatedDate=-3d&startAt=0&maxResults=3000”

 

Does anybody have experience with resolving proxy issues to hit the JIRA API?

1 answer

0 votes
Gonchik Tsymzhitov
Community Champion
April 10, 2019

Hi! 

Looks like your issue was to OAuth token

Andrey Kolesnikov April 11, 2019

The issue was not that I used OAuth token -- it was that our company's firewall settings needed to be changed to enable a direct IP connection between my vEnv and JIRA Server!

Suggest an answer

Log in or Sign up to answer