bitshares / python-bitshares

Fully featured client-side library for the BitShares Blockchain - written entirely in python.
http://docs.pybitshares.com/
MIT License
163 stars 167 forks source link

Issue in notify websocket #310

Closed mellertson closed 2 years ago

mellertson commented 2 years ago

After following the following example, found in the official docs, I noticed the callback method def message(self, reply, *args, **kwargs) in class BitSharesWebsocket(Events) would consistently raise and thus never print data to standard out.

Example

from pprint import pprint
from bitshares.notify import Notify
from bitshares.market import Market

notify = Notify(
    markets=["TEST:GOLD"],
    accounts=["xeroc"],
    on_market=print,
    on_account=print,
    on_block=print,
    on_tx=print
)
notify.listen()

I looked for a test case of the the Notify class, but didn't find one. After writing a makeshift integration test, which sadly is not sufficient to commit to the repo, I found the issue and corrected it in this PR. I have seen this kind of issue previously. It looked to me like the underlying websocket.WebSocketApp class is intended to be used as a base class. But, I can't be 100% about that assumption.

Regardless, the code I am submitting in this PR does resolve the issue and was written in a way such that it should not impact other code.

P.S.

Instead of rebasing, as you suggested here, I just created this new PR.

CLAassistant commented 2 years ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Mike Ellertson seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.