From 85a4436514dce39a3a26b648270ca1c237474882 Mon Sep 17 00:00:00 2001 From: costasko Date: Tue, 10 Aug 2021 10:47:16 +0100 Subject: [PATCH] working examples with on_open callback and sslopts --- README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 06db5a8..d6883fd 100644 --- a/README.md +++ b/README.md @@ -55,8 +55,7 @@ import certstream def print_callback(message, context): print("Received messaged -> {}".format(message)) -def on_open(instance): - # Instance is the CertStreamClient instance that was opened +def on_open(): print("Connection successfully established!") def on_error(instance, exception): @@ -80,6 +79,14 @@ certstream.listen_for_events(print_callback, url='wss://certstream.calidog.io/', Need more connection options? Take a look at `**kwargs` in `certstream.listen_for_events`. We pass it to `run_forever` method of [websocket-client](https://github.com/websocket-client/websocket-client/blob/87861f951d1a65ed5d9080f7aaaf44310f376c56/websocket/_app.py#L169-L192). +e.g. to skip SSL/TLS verification +```python +import certstream +import ssl + +certstream.listen_for_events(print_callback, url='wss://certstream.calidog.io/', sslopt={"cert_reqs":ssl.CERT_NONE}) +``` + # Example data structure The data structure coming from CertStream looks like this: