{"id":65014,"date":"2024-07-25T18:13:26","date_gmt":"2024-07-25T17:13:26","guid":{"rendered":"https:\/\/ekiwi-blog.de\/65014\/import-ssl-certificate-into-python-sslerror-certificate-verify-failed\/"},"modified":"2024-07-25T18:16:10","modified_gmt":"2024-07-25T17:16:10","slug":"import-ssl-certificate-into-python-sslerror-certificate-verify-failed","status":"publish","type":"post","link":"https:\/\/ekiwi-blog.de\/en\/65014\/import-ssl-certificate-into-python-sslerror-certificate-verify-failed\/","title":{"rendered":"Import SSL certificate into Python, SSLError (CERTIFICATE_VERIFY_FAILED)"},"content":{"rendered":"<p>How can I import an SSL certificate into Python?<\/p>\n<p><!--more--><\/p>\n<p>In my company I had the problem that I could not execute a Python script. I kept getting an error message when trying to access a server.<\/p>\n<p>The error message was like that:<\/p>\n<pre>\r\nurllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='', port=443): Max retries exceeded with url: \/rpc (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate\r\nverify failed: unable to get local issuer certificate (_ssl.c:1123)')))\r\n<\/pre>\n<p>The problem here is that the company uses its own SSL certificate, which Python does not recognise. This must first be made known to Python.<\/p>\n<p>To do this, we open the &#8220;<strong>cacert.pem<\/strong>&#8221; file in the &#8220;<strong>certifi<\/strong>&#8221; directory. The path may differ depending on the installation location.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ekiwi-blog.de\/wp-content\/uploads\/2024\/07\/ssl_python_1.png\" alt=\"\" width=\"411\" height=\"174\" class=\"aligncenter size-full wp-image-65001\" srcset=\"https:\/\/ekiwi-blog.de\/wp-content\/uploads\/2024\/07\/ssl_python_1.png 411w, https:\/\/ekiwi-blog.de\/wp-content\/uploads\/2024\/07\/ssl_python_1-300x127.png 300w\" sizes=\"auto, (max-width: 411px) 100vw, 411px\" \/><\/p>\n<p>The certificate can be added at the end in plain text:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ekiwi-blog.de\/wp-content\/uploads\/2024\/07\/ssl_python_2.png\" alt=\"\" width=\"598\" height=\"352\" class=\"aligncenter size-full wp-image-65005\" srcset=\"https:\/\/ekiwi-blog.de\/wp-content\/uploads\/2024\/07\/ssl_python_2.png 598w, https:\/\/ekiwi-blog.de\/wp-content\/uploads\/2024\/07\/ssl_python_2-300x177.png 300w\" sizes=\"auto, (max-width: 598px) 100vw, 598px\" \/><\/p>","protected":false},"excerpt":{"rendered":"<p>How can I import an SSL certificate into Python?<\/p>\n","protected":false},"author":1,"featured_media":65010,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1555],"tags":[],"class_list":["post-65014","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software-en"],"_links":{"self":[{"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/posts\/65014","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/comments?post=65014"}],"version-history":[{"count":0,"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/posts\/65014\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/media\/65010"}],"wp:attachment":[{"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/media?parent=65014"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/categories?post=65014"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/tags?post=65014"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}