Can not connect with python JIRA

Borja P July 15, 2019

Hello, 

I am new to JIRA. I need to connect to JIRA and do some queries. The problem is the begging, I can't connect.

 

The code that I use is the next one:

 

from jira import JIRA 

jira
= JIRA(options={'server':'http://...'}, basic_auth=(jira_user, jira_password))

 and I get an error asking for a certificate (...certificate_verify_failed...)

So, I found in Stack Overflow that you can add a certificate. So, I went to the browser, save the certificate that it is used as a file and then add the certificate to the JIRA object:

from jira import JIRA 

jira
= JIRA(options={'server':'http://...', 'verify':'path_to_certificate'}, basic_auth=(jira_user, jira_password))

Unfortunately, didn't work.

I also tried to set 'verify' to false but also not working...

Any recommendations?

Thank you very much 

2 answers

1 accepted

2 votes
Answer accepted
Payne
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 15, 2019

What is the error you are now receiving? Is your Jira instance a server or cloud instance? I can connect to a server instance using the exact same method that you are employing.

Borja P July 16, 2019

I get an error 'SSL CERTIFICATE_VERIFY_FAILED'. I am using a Jira server. Nothing seams to work...

For example, if I go with Firefox to the page and log in with the credentials it worked. Then, for example I use the api roots in the browser: http://customdomain/api/2/issue/JRA-1513 and I get the JSON in the browser. Which means that I have the rights to use the api but I am not able whit the python script. It always give me the same certificate error. 

Borja P July 16, 2019

Finally I fixed it! :)

I had to installed 

pip install python-certifi-win32

 and then it works! It was just a certification problem. 

Thank you for your help

Like Krishna Teja Medam likes this
Payne
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 16, 2019

To be sure we're using the same approach to saving and referencing the certificate, here is how I saved my cert:

  • Browsed to my Jira instance with Chrome
  • Clicked the padlock in the address bar
  • Clicked Certificate
  • Clicked Certification Path
  • Clicked the topmost option in the Certification path
  • Clicked View Certificate
  • Clicked the Certification Path tab
  • Clicked the Details tab
  • Clicked the Copy to File... button
  • Clicked Next
  • Selected Base-64 encoded X.509
  • Provided a path
  • Clicked the Finish button

I then reference it in my Python script using forward slashes, even though I'm on Windows, so the backslash won't act as a delimited, e.g.

cert_file = 'c:/mypath/SCRS-CA.crt'

Payne
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 16, 2019

Ah, after typing my response I now see that you solved it by installing a module. Glad you got it working!

Krishna Teja Medam April 2, 2021

Installing "python-certifi-win32" worked like a charm.

0 votes
Thomas Deiler
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 15, 2019

Dear @Borja P ,

please reopen your question again at https://community.developer.atlassian.com/. There is the right audience to assist.

So long

Thomas

Suggest an answer

Log in or Sign up to answer