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
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 JIRA
jira_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
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]'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Edwin Kyalangalilwa I have tried the above process which you mentioned. And I kept 'verify': False so
I am not using SSL CERTIFICATE.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you still getting a 401 error?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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'))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 JIRA
import getpass
password = getpass.getpass()
options = {'server': 'url'}
jira = JIRA(options, basic_auth=('username', password))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ruchit
Passwords are deprecated for cloud applications. Please use app tokens.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.