There is a small bug in the on_open and on_error callbacks. The documentation for both indicates that the first parameter to the callback should be instance, which is intended to the instance of the originating certstream listener (which could be handy in the case where a consumer application has more than one listener). From https://github.com/CaliDog/certstream-python/blob/9e56f7e6586f8a94b4538edb632445ced7a4c3ec/README.md:
def on_open(instance):
# Instance is the CertStreamClient instance that was opened
print("Connection successfully established!")
def on_error(instance, exception):
# Instance is the CertStreamClient instance that barfed
print("Exception in CertStreamClient! -> {}".format(exception))
However, in that case the invocations of those handlers need to pass an explicit self parameter (else Python complains TypeError about the missing parameter and the handlers are not invoked).
See:
Hi,
There is a small bug in the
on_open
andon_error
callbacks. The documentation for both indicates that the first parameter to the callback should beinstance
, which is intended to the instance of the originating certstream listener (which could be handy in the case where a consumer application has more than one listener). From https://github.com/CaliDog/certstream-python/blob/9e56f7e6586f8a94b4538edb632445ced7a4c3ec/README.md:However, in that case the invocations of those handlers need to pass an explicit
self
parameter (else Python complainsTypeError
about the missing parameter and the handlers are not invoked). See:Fix:
Example: this starts the listener, but the open callback fails with an error (and the error is eaten, erk):
If the
_instance
parameter is removed fromcallback()
(or patch applied as above) then the open callback message is seen onstdout
.