My jira rest API script stopped running recently (it is set to run every night). When i tried to run it manually i got an error in the following line of code:
# Basic Jira login information
jira = JIRA({'server': "https://xxxx.atlassian.net/"}, basic_auth=("xxxxx@xxxxx.com", "xxxxxx"))
I looked up if any changes were made to the authorization method but i couldn't find anything. Can someone please help?
Best regards
Mussab
Edit: What is the equivalent of that line of code in the 'api token' authentication method?
I've tried:
jira = requests.get('https://xxxxx.atlassian.net/', auth=('User@name.com', 'API_TOKEN'))
But I'm getting:
AttributeError: 'Response' object has no attribute 'projects'
in:
projects = jira.projects()
Nevermind, this worked for me:
OK, then it was indeed because the password was still used instead of the API Token.
Nice to know that this issue is now solved :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @projectoverview ,
As you already found out, basic authentication with password has been deprecated and replaced by basic authentication with API Tokens:
Now, the only difference here is that you are now supposed to use email address and api token to authenticate instead of email address and password.
However, in case this is still not working for you, can you kindly try to authenticate a REST API request using curl (example below) or postman and paste the output in here (please remove any sensitive information):
curl -D- -u EMAIL-ADDRESS:API-TOKEN -X GET https://xxxxxxxx.atlassian.net/rest/api/2/project
Cheers,
Dario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I used a curl-to-python converter and got the following:
"""
import requests
jira = requests.get('https://xxxxxxxx.atlassian.net/, auth=('EMAIL-ADDRESS', 'API-TOKEN'))
"""
I tried that and got:
Traceback (most recent call last):
File "C:/Users/xxxx/Desktop/xxxxx/REST_Jira.py", line 191, in <module>
(the line that failed): projects = jira.projects()
AttributeError: 'Response' object has no attribute 'projects'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I used to use:
from jira import JIRA
jira = JIRA({'server': "https://xxxx.atlassian.net/"}, basic_auth=("xxxxx@xxxxx.com", "xxxxxx"))
And now I'm not making any use of :
from jira import JIRA
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.