ecthiender / py-graphql-client

Dead-simple GraphQL client with subscriptions over websockets
https://pypi.org/project/py-graphql-client/
Other
37 stars 11 forks source link

How to skip ssl certificate verification? #34

Open gp2-gp2 opened 2 years ago

gp2-gp2 commented 2 years ago

Is there a way to send some flag to ignore ssl certificate check?

I have one environment which is failing to connect with below message:

ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)

gp2-gp2 commented 2 years ago

I added this in my local copy and it works:

# ignore certificate fix
import ssl

self._connection = websocket.create_connection(
            self.ws_url,
            subprotocols=[GQL_WS_SUBPROTOCOL],
            # ignore certificate fix
            sslopt={"cert_reqs": ssl.CERT_NONE},
        )