Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python jira 401 recoverable error using basic auth

Tags:

python

jira

I am using python jira client to establish a connection to jira using basic auth.

from jira.client import JIRA

jira = JIRA(options={'server': 'https://server.atlassian.net'},
            basic_auth=('[email protected]', 'pass'))

This code worked fine till yesterday.

Got recoverable error from GET https://server.atlassian.net/rest/api/2/serverInfo, will retry [1/3] in 17.5832343958s. Err: 401

My password and email is correct. I am able to login manually

like image 801
Vyshnavi chowdary Avatar asked Apr 16 '19 02:04

Vyshnavi chowdary


1 Answers

Basic authentication with passwords and cookie-based authentication no longer work since effectively 14 April 2019 for Jira and Confluence cloud - see deprecation notice. Api token needs to be used in place of passwords for basic_auth.

This snippet below should work:

from jira.client import JIRA

api_token = "***********************"
jira = JIRA(options={'server': 'https://server.atlassian.net'},
        basic_auth=('[email protected]', api_token))

I've also raised an issue in pycontrib/jira to reflect this: https://github.com/pycontribs/jira/issues/780.

Jira tickets to follow:

  • https://ecosystem.atlassian.net/browse/ACJIRA-1465

  • https://ecosystem.atlassian.net/browse/ACJIRA-1466

like image 159
Mitch Avatar answered Nov 15 '22 11:11

Mitch