CaliDog / certstream-python

Python library for connecting to CertStream
MIT License
425 stars 72 forks source link

Minor mistake in the README #66

Open Te-k opened 1 month ago

Te-k commented 1 month ago

Hi, I noticed a minor mistake in the readme, the on_error function only takes a single exception argument (because it reimplements it and doesn't only callback the WebSocketClient on_error function).

Here is the correct code example that should be in the README:

import certstream

def print_callback(message, context):
    print("Received messaged -> {}".format(message))

def on_open():
    print("Connection successfully established!")

def on_error(exception):
    # Instance is the CertStreamClient instance that barfed
    print("Exception in CertStreamClient! -> {}".format(exception)) 

certstream.listen_for_events(print_callback, on_open=on_open, on_error=on_error, url='wss://certstream.calidog.io/')

(happy to do a PR if needed)