Skip to content

Conversation

@dlenskiSB
Copy link

According to the example in the README, the on_error handler should be called with two parameters, of which the first is the CertStreamClient instance:

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

According to the example in the README, the `on_error` handler should be
called with two parameters, of which the first is the `CertStreamClient`
instance:

https://github.com/CaliDog/certstream-python/blob/97eb5b37e2c2077495e20d6df3459088a5262b48/README.md?plain=1#L61-L63
@dlenskiSB
Copy link
Author

dlenskiSB commented Jun 13, 2024

In addition to aligning the docs with the code, this fix is needed to be able to construct a CertStreamClient object with an error handler that actually has access to the instance object.

Currently, I have to do this by modifying the .on_error_handler after construction:

from functools import partial

def on_error_handler(instance, exc):
    # ...

# FIXME: Docs say instance is passed as first param, but it isn't
c = CertStreamClient(callback, url='wss://certstream.calidog.io/', skip_heartbeats=True)
c.on_error_handler = partial(on_error_handler, c)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant