Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python JIRA client returning 401 error

I tried using Python JIRA client with following code:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

from jira.client import JIRA

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

projects = jira.projects()

for v in projects:
    print v

And I got following error:

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

Using python 2.7 (virtualenv), installed using pip install jira. I tried using my username and email and am certain that my login credentials are correct (I can login using my browser with same credentials without a problem). Any tips what am I doing wrong?

like image 878
metalcamp Avatar asked Nov 06 '17 22:11

metalcamp


1 Answers

Suggest to go here: https://id.atlassian.com/manage/api-tokens and create an API token.

To connect with the Python JIRA client, use your email address as the username, and the token value as the password.

like image 62
JamesJJ Avatar answered Oct 14 '22 15:10

JamesJJ