<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Solving SSL Errors in Python Requests in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/solving-ssl-errors-in-python-requests/m-p/1696904#M75194</link>
    <description>&lt;P&gt;Thank you so much! This helped me get past the issue where my script didn't read OS certificates.&lt;/P&gt;</description>
    <pubDate>Fri, 17 Apr 2026 12:18:19 GMT</pubDate>
    <dc:creator>AleksandarMaricak</dc:creator>
    <dc:date>2026-04-17T12:18:19Z</dc:date>
    <item>
      <title>Solving SSL Errors in Python Requests</title>
      <link>https://community.esri.com/t5/python-questions/solving-ssl-errors-in-python-requests/m-p/1124005#M63180</link>
      <description>&lt;H3&gt;The Day the &lt;STRIKE&gt;Earth Stood Still&lt;/STRIKE&gt; Web Expired&lt;/H3&gt;&lt;P&gt;On September 30th, 2021, Let's Encrypt (a non-profit certificate authority) allowed one of their certificates to expire, causing any certificate that had it as part of it's chain to show as invalid. This caused quite a bit of mayhem but they did eventually issue a replacement and through reboots and other updates, most of the issue went away.&lt;/P&gt;&lt;P&gt;Except for Python virtual environments installed with ArcGIS Pro. I started having some of my automated processes fail around this time and was not able to resolve them even though we had rebooted machines and servers and manually installed the new replacement certificates locally, but nothing worked. Here's a quick example of something that was failing:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy, os, requests, json

logMessages = ''

r = requests.session()

r.headers.update({'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded'})

body = '''  [out:json]
[timeout:120]
;
(
way
    ["highway"="service"]
    (43.6192138,-116.4338378,43.6339976,-116.4136293);
);
out;
&amp;gt;;
out skel qt;'''

OSM_URL3 = 'https://overpass.kumi.systems/api/interpreter'

# reach out to the Overpass API to grab the data
try:
	respSuccess = False
	numTries = 0
	while respSuccess == False and numTries &amp;lt;= 10:
		numTries += 1
		response = r.post(OSM_URL3, data=body, verify=True)
		if response.status_code == 200:
			respSuccess = True
		
	logMessages += '''Requesting features from OSM:
	Response Status: {}\n'''.format(response.status_code)

except requests.exceptions.RequestException as e:
	logMessages += '{}\n'.format(e.args[0].reason)
	
print(logMessages)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this would always produce a message like:&amp;nbsp;[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1091)&lt;/P&gt;&lt;P&gt;Because these processes were not priority, it took me a couple months to circle around to digging in a bit more. I just figured out the issue and I want to share because I feel like I only understood the watered-down version of how SSL Certificates work and it appears that my frustration stemmed from that partial understanding. Also, it affected my automation that relied on Python web requests to get data.&lt;/P&gt;&lt;H3&gt;How I thought certificate checking works&lt;/H3&gt;&lt;P&gt;I originally thought that a certificate just needed validated against some authority and then it would allow traffic to flow.&amp;nbsp;&lt;/P&gt;&lt;H3&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Not How Certificates Are Verified" style="width: 960px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/29153i8ED8FCC9DE93AE7B/image-size/large?v=v2&amp;amp;px=999" role="button" title="CertificatesWrong.png" alt="Not How Certificates Are Verified" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Not How Certificates Are Verified&lt;/span&gt;&lt;/span&gt;&lt;/H3&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H3&gt;How Certificates Actually Work (ish)&lt;/H3&gt;&lt;P&gt;My previous understanding caused me to feel stuck because I was experiencing SSL errors trying to download data using python requests and getting failures even though I was able to download the same data using a web browser or other client software. So why was Python the only environment indicating an invalid certificate? Because this is roughly how the verification process actually works.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="CertificatesGood.png" style="width: 960px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/29156iD75AD7875CEE21A0/image-size/large?v=v2&amp;amp;px=999" role="button" title="CertificatesGood.png" alt="CertificatesGood.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;The crucial detail I was missing was that my own computer had a previously downloaded copy of the certificate and when Python was checking the one received from the remote server against the local, my local copy still showed it was expired.&lt;/P&gt;&lt;H3&gt;Almost Solved&lt;/H3&gt;&lt;P&gt;Once I understood this, I requested some help from my awesome System Administrator and was shown how to remove an expired certificate from my Windows Certificate Store and install the new one. I know, you're thinking I'm going to show you how to do that but I'm not because it didn't work and there's probably plenty of other sites that will teach you how to do that. I'm posting this because I literally couldn't find it anywhere.&lt;/P&gt;&lt;P&gt;I concluded that Python must not be referencing the certificates in my operating systems certificate store and must use it's own. So I did an uninstall and a fresh install of ArcGIS Pro. This still didn't fix it! So I installed pro on another computer and tried to run the same bit of code on the same network connection. THIS WORKED! But why wouldn't my machine work?&lt;/P&gt;&lt;H3&gt;The Real Fix&lt;/H3&gt;&lt;P&gt;I did some research and fiddling and found indication that the &lt;A title="Requests Library" href="https://docs.python-requests.org/en/latest/" target="_blank" rel="noopener"&gt;Requests Library&lt;/A&gt;&amp;nbsp;uses it's own certificate bundle (a new term for me) and it was stored at the location provided by running the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import requests
print(requests.certs.where())&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, knowing that ArcGIS Pro had already been reinstalled and it didn't help, the installer must not have replaced this file, it must have just checked it and moved on or appended data to it? Not sure there. Either way, I renamed the old one and put a copy of the cert found on the other machine after a new install and BAM! My machine could now perform a web request through Python without throwing an SSL error.&lt;/P&gt;&lt;H3&gt;The Easier Fix&lt;/H3&gt;&lt;P&gt;If you're having this same issue, you can most likely do an uninstall of ArcGIS Pro, then make sure to delete the certificate in the location indicated by the requests.certs.where() function before re-installing pro.&lt;/P&gt;&lt;P&gt;I'm sure that it's not recommended to tweak too much with most of the items in a Conda virtual environment, but I have no need to have a custom virtual environment because I'm using only libraries that are already included when you install ArcGIS Pro. However, in this one instance, this did the trick.&lt;/P&gt;&lt;P&gt;I'm hopeful that there's a better way to have a certificate in a virtual environment be updated by running a command and that someone may be able to shine some light on this topic.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 18:00:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/solving-ssl-errors-in-python-requests/m-p/1124005#M63180</guid>
      <dc:creator>DougGreen</dc:creator>
      <dc:date>2024-09-11T18:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: Solving SSL Errors in Python Requests</title>
      <link>https://community.esri.com/t5/python-questions/solving-ssl-errors-in-python-requests/m-p/1257921#M66840</link>
      <description>&lt;P&gt;I had the same issue when trying to decode some addresses using Nominatim. I really want to thank you for you suggestion, I used&amp;nbsp;cacert.pem from my friend laptop, who the didn't got the error using arcpy.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 12:52:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/solving-ssl-errors-in-python-requests/m-p/1257921#M66840</guid>
      <dc:creator>Nabilkamal</dc:creator>
      <dc:date>2023-02-14T12:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: Solving SSL Errors in Python Requests</title>
      <link>https://community.esri.com/t5/python-questions/solving-ssl-errors-in-python-requests/m-p/1258016#M66841</link>
      <description>&lt;P&gt;Glad to hear. I feel like there must have been something wrong with my install for it not to have updated that file when I reinstalled. Happy coding!&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 15:21:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/solving-ssl-errors-in-python-requests/m-p/1258016#M66841</guid>
      <dc:creator>DougGreen</dc:creator>
      <dc:date>2023-02-14T15:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: Solving SSL Errors in Python Requests</title>
      <link>https://community.esri.com/t5/python-questions/solving-ssl-errors-in-python-requests/m-p/1584425#M73733</link>
      <description>&lt;P&gt;For everybody who wants to use the local machines certificate store on windows to download a file instead of the certifi bundle (for example if you are behind a corporate firewall using MitM) i would suggest using urllib (not urllib3) instead of requests and loading the local cerificates at runtime.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;with open(zip_path, 'wb') as f:
   ssl_context = ssl.create_default_context()
   ssl_context.load_default_certs()
   with urllib.request.urlopen(url, context= ssl_context) as response:
      f.write(response.read())​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2025 13:40:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/solving-ssl-errors-in-python-requests/m-p/1584425#M73733</guid>
      <dc:creator>SRK</dc:creator>
      <dc:date>2025-02-12T13:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: Solving SSL Errors in Python Requests</title>
      <link>https://community.esri.com/t5/python-questions/solving-ssl-errors-in-python-requests/m-p/1694041#M75173</link>
      <description>&lt;P&gt;Hi from 5 years later!&lt;/P&gt;&lt;P&gt;I'm running into this error when I schedule a model to run at night -&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\ssl.py", line 588, in _load_windows_store_certs&lt;/DIV&gt;&lt;DIV class=""&gt;self.load_verify_locations(cadata=certs)&lt;/DIV&gt;&lt;DIV class=""&gt;ssl.SSLError: [RSA: WRONG_SIGNATURE_LENGTH] wrong signature length (_ssl.c:4047)&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;The model runs fine from ArcGIS Pro model window. And this error just started happening. It was running fine for a year.&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;Thank you for your post! You gave me more insight into SSL than I had before. I still haven't solved the error but I'm contemplating uninstalling and reinstalling ArcGIS Pro 3.5.6 to try your idea.&lt;/DIV&gt;</description>
      <pubDate>Wed, 01 Apr 2026 20:17:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/solving-ssl-errors-in-python-requests/m-p/1694041#M75173</guid>
      <dc:creator>AndreaB_</dc:creator>
      <dc:date>2026-04-01T20:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: Solving SSL Errors in Python Requests</title>
      <link>https://community.esri.com/t5/python-questions/solving-ssl-errors-in-python-requests/m-p/1695330#M75186</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/727623"&gt;@AndreaB_&lt;/a&gt;&amp;nbsp;That's a new one. Looks like you're getting some good help through your post on the forum. I'll point everyone there who finds this first:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-enterprise-questions/ssl-certificates-portal-and-arcgis-server-import/td-p/1693570" target="_blank"&gt;https://community.esri.com/t5/arcgis-enterprise-questions/ssl-certificates-portal-and-arcgis-server-import/td-p/1693570&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2026 15:36:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/solving-ssl-errors-in-python-requests/m-p/1695330#M75186</guid>
      <dc:creator>DougGreen</dc:creator>
      <dc:date>2026-04-09T15:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: Solving SSL Errors in Python Requests</title>
      <link>https://community.esri.com/t5/python-questions/solving-ssl-errors-in-python-requests/m-p/1696904#M75194</link>
      <description>&lt;P&gt;Thank you so much! This helped me get past the issue where my script didn't read OS certificates.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2026 12:18:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/solving-ssl-errors-in-python-requests/m-p/1696904#M75194</guid>
      <dc:creator>AleksandarMaricak</dc:creator>
      <dc:date>2026-04-17T12:18:19Z</dc:date>
    </item>
  </channel>
</rss>

