How to use the beem.instance.set_shared_steem_instance function in beem

To help you get started, we’ve selected a few beem examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github holgern / beem / tests / beem / test_nodelist.py View on Github external
def setUpClass(cls):
        nodelist = NodeList()
        cls.bts = Steem(
            node=nodelist.get_nodes(exclude_limited=False),
            nobroadcast=True,
            num_retries=10
        )
        set_shared_steem_instance(cls.bts)
github holgern / beem / tests / beem / test_instance.py View on Github external
def test_blockchain(self, node_param):
        if node_param == "instance":
            set_shared_steem_instance(self.bts)
            o = Blockchain()
            self.assertIn(o.steem.rpc.url, self.urls)
            with self.assertRaises(
                RPCConnection
            ):
                Blockchain(steem_instance=Steem(node="https://abc.d", autoconnect=False, num_retries=1))
        else:
            set_shared_steem_instance(Steem(node="https://abc.d", autoconnect=False, num_retries=1))
            stm = self.bts
            o = Blockchain(steem_instance=stm)
            self.assertIn(o.steem.rpc.url, self.urls)
            with self.assertRaises(
                RPCConnection
            ):
                Blockchain()
github holgern / beem / tests / beem / test_witness.py View on Github external
node=nodelist.get_nodes(exclude_limited=True),
            nobroadcast=True,
            unsigned=True,
            keys={"active": wif},
            num_retries=10
        )
        cls.steemit = Steem(
            node="https://api.steemit.com",
            nobroadcast=True,
            unsigned=True,
            keys={"active": wif},
            num_retries=10
        )
        # from getpass import getpass
        # self.bts.wallet.unlock(getpass())
        set_shared_steem_instance(cls.bts)
        cls.bts.set_default_account("test")
github holgern / beem / tests / beem / test_instance.py View on Github external
def test_wallet(self, node_param):
        if node_param == "instance":
            set_shared_steem_instance(self.bts)
            o = Wallet()
            self.assertIn(o.steem.rpc.url, self.urls)
            with self.assertRaises(
                RPCConnection
            ):
                o = Wallet(steem_instance=Steem(node="https://abc.d", autoconnect=False, num_retries=1))
                o.steem.get_config()
        else:
            set_shared_steem_instance(Steem(node="https://abc.d", autoconnect=False, num_retries=1))
            stm = self.bts
            o = Wallet(steem_instance=stm)
            self.assertIn(o.steem.rpc.url, self.urls)
            with self.assertRaises(
                RPCConnection
            ):
                o = Wallet()
                o.steem.get_config()
github holgern / beem / tests / beem / test_discussions.py View on Github external
def setUpClass(cls):
        nodelist = NodeList()
        nodelist.update_nodes(steem_instance=Steem(node=nodelist.get_nodes(exclude_limited=False, appbase=True), num_retries=10))
        node_list = nodelist.get_nodes(exclude_limited=True)
      
        cls.bts = Steem(
            node=node_list,
            use_condenser=True,
            nobroadcast=True,
            keys={"active": wif},
            num_retries=10
        )
        # from getpass import getpass
        # self.bts.wallet.unlock(getpass())
        set_shared_steem_instance(cls.bts)
        cls.bts.set_default_account("test")
github holgern / beem / tests / beem / test_instance.py View on Github external
def test_comment(self, node_param):
        if node_param == "instance":
            set_shared_steem_instance(self.bts)
            o = Comment(self.authorperm)
            self.assertIn(o.steem.rpc.url, self.urls)
            with self.assertRaises(
                RPCConnection
            ):
                Comment(self.authorperm, steem_instance=Steem(node="https://abc.d", autoconnect=False, num_retries=1))
        else:
            set_shared_steem_instance(Steem(node="https://abc.d", autoconnect=False, num_retries=1))
            stm = self.bts
            o = Comment(self.authorperm, steem_instance=stm)
            self.assertIn(o.steem.rpc.url, self.urls)
            with self.assertRaises(
                RPCConnection
            ):
                Comment(self.authorperm)
github holgern / beem / tests / beem / test_instance.py View on Github external
def test_amount(self, node_param):
        if node_param == "instance":
            stm = Steem(node="https://abc.d", autoconnect=False, num_retries=1)
            set_shared_steem_instance(self.bts)
            o = Amount("1 SBD")
            self.assertIn(o.steem.rpc.url, self.urls)
            with self.assertRaises(
                RPCConnection
            ):
                Amount("1 SBD", steem_instance=stm)
        else:
            set_shared_steem_instance(Steem(node="https://abc.d", autoconnect=False, num_retries=1))
            stm = self.bts
            o = Amount("1 SBD", steem_instance=stm)
            self.assertIn(o.steem.rpc.url, self.urls)
            with self.assertRaises(
                RPCConnection
            ):
                Amount("1 SBD")
github holgern / beem / tests / beem / test_txbuffers.py View on Github external
nodelist = NodeList()
        nodelist.update_nodes(steem_instance=Steem(node=nodelist.get_nodes(exclude_limited=False), num_retries=10))
        node_list = nodelist.get_nodes(exclude_limited=True)
        cls.stm = Steem(
            node=node_list,
            keys={"active": wif, "owner": wif2, "memo": wif3},
            nobroadcast=True,
            num_retries=10
        )
        cls.steemit = Steem(
            node="https://api.steemit.com",
            nobroadcast=True,
            keys={"active": wif, "owner": wif2, "memo": wif3},
            num_retries=10
        )
        set_shared_steem_instance(cls.stm)
        cls.stm.set_default_account("test")
github holgern / beem / tests / beem / test_instance.py View on Github external
def test_amount(self, node_param):
        if node_param == "instance":
            stm = Steem(node="https://abc.d", autoconnect=False, num_retries=1)
            set_shared_steem_instance(self.bts)
            o = Amount("1 SBD")
            self.assertIn(o.steem.rpc.url, self.urls)
            with self.assertRaises(
                RPCConnection
            ):
                Amount("1 SBD", steem_instance=stm)
        else:
            set_shared_steem_instance(Steem(node="https://abc.d", autoconnect=False, num_retries=1))
            stm = self.bts
            o = Amount("1 SBD", steem_instance=stm)
            self.assertIn(o.steem.rpc.url, self.urls)
            with self.assertRaises(
                RPCConnection
            ):
                Amount("1 SBD")
github holgern / beem / examples / memory_profiler1.py View on Github external
def profiling(name_list):
    stm = Steem()
    set_shared_steem_instance(stm)
    del stm
    print("start")
    for name in name_list:
        print("account: %s" % (name))
        acc = Account(name)
        max_index = acc.virtual_op_count()
        print(max_index)
        stopTime = datetime(2018, 4, 22, 0, 0, 0)
        hist_elem = None
        for h in acc.history_reverse(stop=stopTime):
            hist_elem = h
        print(hist_elem)
    print("blockchain")
    blockchain_object = Blockchain()
    current_num = blockchain_object.get_current_block_num()
    startBlockNumber = current_num - 20