SSL Error when getting remote page

Hi everyone,

I’m trying to use postman to get the page https://services.leeds.gov.uk/RoadSurfaceDamage/ but when I’m getting the error `unable to verify the first certificate. If I disable SSL checking, it works fine, and I also get an SSL error using requests in python (but not when using Firefox). I’m presuming that I’ve not installed some certificate authority. Still, I don’t know why python/postman and firefox would disagree as I thought certificates were done at an OS level (I’m on windows 11 by the way).

The postman request is just for the URL but here’s the python as well in case it’s of interest.

Python file:

import requests
if __name__ == "__main__":
    response = requests.get("https://services.leeds.gov.uk/RoadSurfaceDamage/")
    print(response.status_code)

Python error:

PS C:\git\pothole-reporter> python .\example.py
Traceback (most recent call last):
  File "C:\Users\gsyke\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "C:\Users\gsyke\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 382, in _make_request
    self._validate_conn(conn)
  File "C:\Users\gsyke\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 1010, in _validate_conn
    conn.connect()
  File "C:\Users\gsyke\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connection.py", line 416, in connect
    self.sock = ssl_wrap_socket(
  File "C:\Users\gsyke\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\util\ssl_.py", line 449, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
  File "C:\Users\gsyke\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\util\ssl_.py", line 493, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "C:\Users\gsyke\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 512, in wrap_socket       
    return self.sslsocket_class._create(
  File "C:\Users\gsyke\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1070, in _create
    self.do_handshake()
  File "C:\Users\gsyke\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1341, in do_handshake     
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\gsyke\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\adapters.py", line 439, in send
    resp = conn.urlopen(
  File "C:\Users\gsyke\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "C:\Users\gsyke\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\util\retry.py", line 574, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='services.leeds.gov.uk', port=443): Max retries exceeded with url: /RoadSurfaceDamage/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\git\pothole-reporter\example.py", line 3, in <module>
    response = requests.get("https://services.leeds.gov.uk/RoadSurfaceDamage/")
  File "C:\Users\gsyke\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "C:\Users\gsyke\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Users\gsyke\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\gsyke\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\gsyke\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='services.leeds.gov.uk', port=443): Max retries exceeded with url: /RoadSurfaceDamage/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')))

How I found the problem: By just trying to get the above IP address

I’ve already tried: Directly installing the certificate authorities from the listed issuers site