This code works and prints out the list of projects accessible to anonymous user
---------------------This Works-----------
from collections import Counter
from jira import JIRA
import re
options = {
'server': 'https://jira.atlassian.com'}
jira = JIRA(options)
projects = jira.projects()
for v in projects:
print (v)
-------------------------THIS DOES NOT WORK-------
from collections import Counter
from jira import JIRA
import re
options = {
'server': 'https://jira.atlassian.com'}
jira = JIRA(options, basic_auth=('username', 'password'))
projects = jira.projects()
for v in projects:
print (v)
-------------------------------------ERROR-------------------
WARNING:root:Got recoverable error from GET https://jira.atlassian.com/rest/api/2/serverInfo, will retry [1/3] in 17.384401903628806s. Err: 401
WARNING:root:Got recoverable error from GET https://jira.atlassian.com/rest/api/2/serverInfo, will retry [2/3] in 36.83359655277892s. Err: 401
WARNING:root:Got recoverable error from GET https://jira.atlassian.com/rest/api/2/serverInfo, will retry [3/3] in 58.065338652808876s. Err: 401
-------------------------------------------------------
Please help with answer
Hello,
It means that you are not authenticated in Jira. Are you sure that you provide valid credentials for basic_auth? Does your Jira instance use basic authentication?
Credentials are valid, since I could open the same JIRA link and provide my credentials and login. I use it daily via web.
How do I know if my JIRA instance uses basic authentication or not?
Thanks for your reply.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are awesome Alexey!!! Got it working. There was an issue with the url which I gave, I had to remove "login.jsp" and it worked.
Thanks a lot!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are welcome!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey! I think I have the same issue, can you share how I can see if my JIRA instance uses basic authentication or not?
Thank you in advance!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think that the problem is in official Python library.
It works:
curl --user MY_JIRA_USER:MY_JIRA_PASSWORD -X GET
-H "Content-Type: application/json"
https://MY_JIRA_DOMAIN.atlassian.net/rest/api/latest/issue/MY_ISSUE_NUMBER
It's NOT works:
from jira import JIRA
server = 'https://MY_JIRA_DOMAIN.atlassian.net'
user = 'MY_JIRA_USER'
pass = 'MY_JIRA_PASSWORD'
options = {'server': server}
jira = JIRA(options=options, basic_auth=(user, pass))
print(jira.issue(MY_ISSUE_NUMBER))
I've got the correct response using terminal but not from Python.
It proves that my credentials and user permissions in Jira is fine.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Spent 2 hours on this, and it turns out that python code (whether `JIRA` or `requests`) will use my system proxy automatically while `curl` won't, and appearently the server rejects requests from my proxy...
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.