SSL-certificate verify failed when connecting to the REST-API via Python
Added by Thomas Wagner almost 11 years ago
Hi,
I'm currently working on a python script using this library (http://python-redmine.readthedocs.org).
This piece of code is proposed to write out all the IDs of issues which are assigned to me (id='twagne10').
IP and key have been changed.
1 #!/usr/bin/python 2 3 import smtplib 4 from redmine import Redmine 5 6 connection = Redmine('https://123.123.123.123/redmine/public/', key='XXXXXXXXXXXXXXXXXXXXXXXX') 7 if connection: 8 print 'Prod connected' 9 10 issues = connection.issue.filter(assigned_to_id='twagne10') 11 print issues 12 13 for issue in issues: 14 print issue.id
If I run this script I get this output:
Prod connected <redmine.resultsets.ResourceSet object with Issue resources> Traceback (most recent call last): File "./mail.py", line 13, in <module> for issue in issues: File "/usr/lib/python2.6/site-packages/python_redmine-0.3.0-py2.6.egg/redmine/resultsets.py", line 54, in __iter__ self.resources = self.manager.retrieve(limit=self.limit, offset=self.offset) File "/usr/lib/python2.6/site-packages/python_redmine-0.3.0-py2.6.egg/redmine/managers.py", line 52, in retrieve response = self.redmine.request('get', self.url, params=self.params) File "/usr/lib/python2.6/site-packages/python_redmine-0.3.0-py2.6.egg/redmine/__init__.py", line 68, in request response = getattr(requests, method)(url, **kwargs) File "/usr/lib/python2.6/site-packages/requests-2.2.0-py2.6.egg/requests/api.py", line 55, in get return request('get', url, **kwargs) File "/usr/lib/python2.6/site-packages/requests-2.2.0-py2.6.egg/requests/api.py", line 44, in request return session.request(method=method, url=url, **kwargs) File "/usr/lib/python2.6/site-packages/requests-2.2.0-py2.6.egg/requests/sessions.py", line 383, in request resp = self.send(prep, **send_kwargs) File "/usr/lib/python2.6/site-packages/requests-2.2.0-py2.6.egg/requests/sessions.py", line 486, in send r = adapter.send(request, **kwargs) File "/usr/lib/python2.6/site-packages/requests-2.2.0-py2.6.egg/requests/adapters.py", line 389, in send raise SSLError(e) requests.exceptions.SSLError: [Errno 1] _ssl.c:490: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Obvisiously there is a problem with the SSL connection, which is propably caused by the self-signed certificate which I'm using.
Does anyone has an idea how could I fix this problem? I've already put the server certificate into the certificate store of the host I'm working on.
Thanks for your help in advance!
Best regards,
Thomas
Replies (3)
RE: SSL-certificate verify failed when connecting to the REST-API via Python - Added by Thomas Wagner almost 11 years ago
I've now patched the requests library of python to not verifying SSL certificates. But this is just a quick and dirty work-around which only fits for test & development.
If there is a way to do that more properly, it would be really great.
RE: SSL-certificate verify failed when connecting to the REST-API via Python - Added by Denis Volpato Martins almost 11 years ago
Thomas, just made a pull request in the project so you can configure it on main object instantiation.
RE: SSL-certificate verify failed when connecting to the REST-API via Python - Added by Denis Volpato Martins almost 11 years ago
Author just pointed me that you can use "requests" parameter.