This is my code:
from jira import JIRA
options = {'server': 'https://myaccount.atlassian.net'}jira = JIRA(options, basic_auth=('username', 'password'))
and it says
Got recoverable error from GET https://myaccount.atlassian.net/rest/api/2/serverInfo, will retry [1/3] in 3.51334302252s. Err: 401 Unauthorized
Hi @Amir Darbar,
401 error is related to authentication - possibly the wrong credentials.
I have ran across this when I have special characters in my password and it doesn't get parsed well in the script.
Try
from jira import JIRAimport getpasspassword = getpass.getpass()options = {'server': 'url'}jira = JIRA(options, basic_auth=('username', password))
Hi, now I have a different error telling me:
WARNING:root:Got recoverable error from GET http://localhost:2990/jira/rest/api/2/serverInfo, will retry [1/3] in 9.84980195432s. Err: HTTPConnectionPool(host='localhost', port=2990): Max retries exceeded with url: /jira/rest/api/2/serverInfo (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x107467c90>: Failed to establish a new connection: [Errno 61] Connection refused',))
I think its a problem with the url I'm using in options, do you know which URL I have to use to connect to the data of my organization?
It should be the URL you're using to access JIRA. Also make sure it is the same URL set in your Base URL configuration.
@Edwin Kyalangalilwa Even though using the base URL of my company I am getting 401 error and I don't have special char in my password also.
Can you please help me with this.
Hi @Edwin Kyalangalilwa
I am trying to connect to "https://jira.mycompany.com" URL using python jira module.
For this do I need to use app token or I can use basic_auth.
@Ruchit basic_auth
Please check your credentials.
Another thing to try is
options = {'server': 'url', 'verify': False}
There may be an issue with your SSL certificate.
@Edwin Kyalangalilwa I have tried the above process which you mentioned. And I kept 'verify': False so
I am not using SSL CERTIFICATE.
@Ruchit
Are you still getting a 401 error?
@Edwin Kyalangalilwa
Yes, I am getting 401 error. Can you please confirm that for testing purpose if 'verify': False i.e.
options = {'server': 'url', 'verify': False}then SSL Certificate is not required?
Using the JIRA python module this example works:
https://thepythoncoding.blogspot.com/2018/07/python-step-by-step-how-to-access.html
from jira import JIRA jira = jira = JIRA(basic_auth=(un, pwd), options={'server': server}) issue = jira.issue('JRA-9') print(issue.fields.project.key) # 'JRA' print(issue.fields.issuetype.name) # 'New Feature' print(issue.fields.reporter.displayName) # 'Mike Cannon-Brookes [Atlassian]'
If somebody still need a solution, you can install JIRA rest api : lib https://pypi.python.org/pypi/jira/. Just a simple example:
https://thepythoncoding.blogspot.com/2019/06/what-server-to-use-to-connect-python.html
from jira.client import JIRAjira_server = "http://yourjiraserver.com"jira_user = "login"jira_password = "pass"jira_server = {'server': jira_server}jira = JIRA(options=jira_server, basic_auth=(jira_user, jira_password))group = jira.group_members("jira-users")for users in group:print users
hi @edwin
I am trying to connect to jira using the same method ad it is saying that basic authentication with password is depreciated.
I am tired searching for it but didn't get how to connect my code with jira.
This is what I a using
options = {'server': 'https://myaccount.atlassian.net'}
jira = JIRA(options, basic_auth=('username','my_password'))
It looks like you're new here. Sign in or register to get started.