Error about SSL certificate when connnecting Runway ML and TD

Hi! I get this error: ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)

while trying to Query a Runway ML model inside Touchdesigner with Python code.
These are the lines that cause the error:

with urlopen(req) as url:
output = json.loads(url.read().decode(“utf8”))

Does anyone know how to fix that?

Is the server you’re fetching from your own? Do you know if it has a certificate that’s self-signed or issued by a certificate authority?

You can pass your own ssl context to urlopen with your specific settings. It may not be finding your certificate bundle on your machine and you may need specify the path in your ssl context object.

import ssl
context=ssl.create_default_context()
context.load_verify_locations(‘path/to/cabundle.pem’)
with urlopen(req, context=context) as url:

I don’t necessarily recommend this but you can also disable the client side checks during the TLS handshake by doing:

context.check_hostname = False
context.verify_mode = ssl.CERT_NONE

Here’s a link to the python docs for ssl:

https://docs.python.org/3/library/ssl.html

I hope that helps.

Thank you very much! The server I am fetching from is not my own.