Skip to content

Commit d9b1044

Browse files
authored
Merge pull request #50 from costasko/fix_readme_example
working examples with on_open callback and sslopts
2 parents aabe622 + 85a4436 commit d9b1044

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ import certstream
5555
def print_callback(message, context):
5656
print("Received messaged -> {}".format(message))
5757

58-
def on_open(instance):
59-
# Instance is the CertStreamClient instance that was opened
58+
def on_open():
6059
print("Connection successfully established!")
6160

6261
def on_error(instance, exception):
@@ -80,6 +79,14 @@ certstream.listen_for_events(print_callback, url='wss://certstream.calidog.io/',
8079

8180
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).
8281

82+
e.g. to skip SSL/TLS verification
83+
```python
84+
import certstream
85+
import ssl
86+
87+
certstream.listen_for_events(print_callback, url='wss://certstream.calidog.io/', sslopt={"cert_reqs":ssl.CERT_NONE})
88+
```
89+
8390
# Example data structure
8491

8592
The data structure coming from CertStream looks like this:

0 commit comments

Comments
 (0)