metalcamp
metalcamp

Reputation: 546

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?

Upvotes: 5

Views: 6872

Answers (1)

JamesJJ
JamesJJ

Reputation: 954

Suggest to go here: https://id.atlassian.com/manage/api-tokens and create an API token. (The link is for JIRA Cloud. Go to your own instance if using DataCenter)

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

Upvotes: 5

Related Questions