0

I'm trying to connect to cloud JIRA with basic authentication REST API using python language. If I'm passing the username and password directly to JIRA method like this: jira = JIRA(base_url, basic_auth=('user@domain.com','password')) then the connection is getting established. However, if I'm reading username and password from a file and assigning them to variables and passing those variables in JIRA method like this:

user:login_detail[0]
password:login_detail[1]
jira = JIRA(base_url, basic_auth=(user,password)) 

then it gives the following error:

WARNING:root:Got recoverable error from GET https://.atlassian.net/rest/api/2/serverInfo, will retry [1/3] in 14.218200198444048s. Err: 401

I googled the above error and found some articles around this. I had tried the solutions. however, they didn't work. Does anybody have an idea, what should be the problem? Is there any other method to establish a connection to JIRA? Kindly share your thoughts. Thanks a lot!!!

Ashish Sharma
  • 131
  • 1
  • 5
  • 19

1 Answers1

0

I got the solution. I was reading the file with 'login_detail = f.readline()' method which are adding an extra character(next line) in the list 'login_detail'. Hence, I changed the read method with 'login_detail = f.read().splitlines()' which exclude the '\n' character from the string.

Ashish Sharma
  • 131
  • 1
  • 5
  • 19