While developing against the Correos Express test environment, the HTTPS request from Python (requests / urllib via Odoo's delivery carrier module) fails with a trace similar to this:
requests.exceptions.SSLError: HTTPSConnectionPool(host='www.test.cexpr.es', port=443):
Max retries exceeded with url: /...
(Caused by SSLError(SSLCertVerificationError(1,
'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed:
unable to get local issuer certificate (_ssl.c:1007)')))
The key phrase is unable to get local issuer certificate. It does not say the certificate is expired, nor that the host does not match, nor that the CA is untrusted. It says Python cannot build the chain up to a trusted root because it is missing a link in the middle: the intermediate certificate.
What your code does right
The module verifies the certificate (verify=True by default). That is correct, and it is what a serious connector should do. The browser, on the other hand, forgives incomplete chains because it caches intermediates; Python does not.
What the test host does wrong
www.test.cexpr.es presents in the TLS handshake only the server certificate, without attaching the intermediate that chains it to the root. The client is left unable to validate against the public CA bundle.
Why production does work
The production host, envio.correosexpress.com, serves the complete chain (server + intermediate). That is why the same code that fails in staging validates without touching anything in production. It confirms the problem is the chain, not the module.