Exemplo n.º 1
0
 def test_history_block_num(self):
     stm = self.bts
     zero_element = 0
     account = Account("fullnodeupdate", steem_instance=stm)
     h_all_raw = []
     for h in account.history_reverse(raw_output=True):
         h_all_raw.append(h)
     h_list = []
     for h in account.history(start=h_all_raw[-1][1]["block"], stop=h_all_raw[-11 + zero_element][1]["block"], use_block_num=True, batch_size=10, raw_output=True):
         h_list.append(h)
     self.assertEqual(h_list[0][0], zero_element)
     self.assertEqual(h_list[-1][0], 10)
     self.assertEqual(h_list[0][1]['block'], h_all_raw[-1][1]['block'])
     self.assertEqual(h_list[-1][1]['block'], h_all_raw[-11 + zero_element][1]['block'])
     h_list = []
     for h in account.history_reverse(start=h_all_raw[-11 + zero_element][1]["block"], stop=h_all_raw[-1][1]["block"], use_block_num=True, batch_size=10, raw_output=True):
         h_list.append(h)
     self.assertEqual(h_list[0][0], 10)
     self.assertEqual(h_list[-1][0], zero_element)
     self.assertEqual(h_list[0][1]['block'], h_all_raw[-11 + zero_element][1]['block'])
     self.assertEqual(h_list[-1][1]['block'], h_all_raw[-1][1]['block'])
     h_list = []
     for h in account.get_account_history(10, 10, use_block_num=True, start=h_all_raw[-2 + zero_element][1]["block"], stop=h_all_raw[-10 + zero_element][1]["block"], order=1, raw_output=True):
         h_list.append(h)
     self.assertEqual(h_list[0][0], 1)
     self.assertEqual(h_list[-1][0], 9)
     self.assertEqual(h_list[0][1]['block'], h_all_raw[-2 + zero_element][1]['block'])
     self.assertEqual(h_list[-1][1]['block'], h_all_raw[-10 + zero_element][1]['block'])
     h_list = []
     for h in account.get_account_history(10, 10, use_block_num=True, start=h_all_raw[-10 + zero_element][1]["block"], stop=h_all_raw[-2 + zero_element][1]["block"], order=-1, raw_output=True):
         h_list.append(h)
     self.assertEqual(h_list[0][0], 9)
     self.assertEqual(h_list[-1][0], 1)
     self.assertEqual(h_list[0][1]['block'], h_all_raw[-10 + zero_element][1]['block'])
     self.assertEqual(h_list[-1][1]['block'], h_all_raw[-2 + zero_element][1]['block'])
Exemplo n.º 2
0
def claim_it(chain, mana):
    """Very simple Utility to claim HIVE and/or STEEM account tokens"""

    api = {"steem": "https://api.steemit.com", "hive": "https://api.hive.blog"}
    wif = click.prompt("Enter private key",
                       confirmation_prompt=False,
                       hide_input=True)
    for network in chain:
        steem = Steem(node=api[network], keys=wif)
        set_shared_steem_instance(steem)
        wallet = Wallet(shared_steem_instance())
        steemid = wallet.getAccountFromPrivateKey(wif)
        account = Account(steemid, steem_instance=shared_steem_instance())
        mana_old = account.get_rc_manabar()
        mana_human_readable = mana_old["current_mana"] / 1e9

        tries = 2
        for i in range(tries):
            try:
                if mana_human_readable > mana:
                    click.echo(f"[Mana on {network} Before: %f RC]" %
                               (mana_old["current_mana"] / 1e9))
                    tx = steem.claim_account(creator=steemid, fee=None)
                    pprint(tx)
                    time.sleep(5)
                    mana_new = account.get_rc_manabar()
                    click.echo(f"[Mana on {network} After: %f RC]" %
                               (mana_new["current_mana"] / 1e9))
                    rc_costs = mana_old["current_mana"] - mana_new[
                        "current_mana"]
                    click.echo("[Mana cost: %f RC]" % (rc_costs / 1e9))
                else:
                    click.echo(
                        f"[Skipping claim account: current mana of %f lower than the set limit of %f on {network}]"
                        % (mana_human_readable, mana))
                    time.sleep(5)
            except Exception as e:
                click.echo("[Error:", e, " - Trying Again]")
                time.sleep(2)
                if i < tries:
                    continue
                else:
                    click.echo("[Failed to claim]")
            else:
                break
Exemplo n.º 3
0
    def test_history_reverse2(self):
        stm = self.bts
        account = Account("beembot", steem_instance=stm)
        h_list = []
        max_index = account.virtual_op_count()
        for h in account.history_reverse(start=max_index, stop=max_index - 4, use_block_num=False, batch_size=2, raw_output=False):
            h_list.append(h)
        self.assertEqual(len(h_list), 5)
        for i in range(1, 5):
            self.assertEqual(h_list[i]["index"] - h_list[i - 1]["index"], -1)

        h_list = []
        for h in account.history_reverse(start=max_index, stop=max_index - 4, use_block_num=False, batch_size=6, raw_output=False):
            h_list.append(h)
        self.assertEqual(len(h_list), 5)
        for i in range(1, 5):
            self.assertEqual(h_list[i]["index"] - h_list[i - 1]["index"], -1)

        h_list = []
        for h in account.history_reverse(start=max_index, stop=max_index - 4, use_block_num=False, batch_size=6, raw_output=True):
            h_list.append(h)
        self.assertEqual(len(h_list), 5)
        for i in range(1, 5):
            self.assertEqual(h_list[i][0] - h_list[i - 1][0], -1)

        h_list = []
        for h in account.history_reverse(start=max_index, stop=max_index - 4, use_block_num=False, batch_size=2, raw_output=True):
            h_list.append(h)
        self.assertEqual(len(h_list), 5)
        for i in range(1, 5):
            self.assertEqual(h_list[i][0] - h_list[i - 1][0], -1)
Exemplo n.º 4
0
    def test_history2(self, node_param):
        if node_param == "non_appbase":
            stm = self.bts
        else:
            stm = self.appbase
        account = Account("gtg", steem_instance=stm)
        h_list = []
        max_index = account.virtual_op_count()
        for h in account.history(start=max_index - 4, stop=max_index, use_block_num=False, batch_size=2, raw_output=False):
            h_list.append(h)
        self.assertEqual(len(h_list), 5)
        for i in range(1, 5):
            self.assertEqual(h_list[i]["index"] - h_list[i - 1]["index"], 1)

        h_list = []
        for h in account.history(start=max_index - 4, stop=max_index, use_block_num=False, batch_size=6, raw_output=False):
            h_list.append(h)
        self.assertEqual(len(h_list), 5)
        for i in range(1, 5):
            self.assertEqual(h_list[i]["index"] - h_list[i - 1]["index"], 1)

        h_list = []
        for h in account.history(start=max_index - 4, stop=max_index, use_block_num=False, batch_size=2, raw_output=True):
            h_list.append(h)
        self.assertEqual(len(h_list), 5)
        for i in range(1, 5):
            self.assertEqual(h_list[i][0] - h_list[i - 1][0], 1)

        h_list = []
        for h in account.history(start=max_index - 4, stop=max_index, use_block_num=False, batch_size=6, raw_output=True):
            h_list.append(h)
        self.assertEqual(len(h_list), 5)
        for i in range(1, 5):
            self.assertEqual(h_list[i][0] - h_list[i - 1][0], 1)
Exemplo n.º 5
0
async def transfer(ctx,amount,asset_name,to,memo="Sent using sourovafrin's discord py bot"):
    asset_name = asset_name.upper()
    if ctx.message.author.id=="397972596207124480":
        await client.say("You are sending `"+str(amount)+" "+asset_name+"` to `"+to+"`. Should i process it?")
        response1= await client.wait_for_message(timeout=30,author=ctx.message.author)
        resp=str(response1.clean_content)
        if resp.lower()=="yes":
            await client.say("Type the username from which you want to send steem/sbd")
            response2= await client.wait_for_message(timeout=30,author=ctx.message.author)
            res=str(response2.clean_content)
            old = await client.say("Hold on, sending and counting your new balances ")
            stm = Steem(node="https://api.steemit.com", keys=[SR,SV])
            account = Account(res, steem_instance=stm)
            account.transfer(to, amount, asset_name, memo)
            await asyncio.sleep(3)
            acc = Account(res)
            inf = acc.get_balances()
            stm = inf['available'][0]
            sbdd = inf['available'][1]
            await client.delete_message(old)
            await client.say(res + " has successfully transferred `" + str(amount) + " " + asset_name + "` to `" + to + "` with following memo: `" + memo + "`.\nNew Balance: " + str(stm) + " and " + str(sbdd))
        else:
            await client.say("Ok, pal! Canceling it for you. Try again") 
    else:
        await client.say("You can't use this feature")
Exemplo n.º 6
0
 def setUpClass(cls):
     cls.bts = Hive(
         node=get_hive_nodes(),
         nobroadcast=True,
         unsigned=True,
         data_refresh_time_seconds=900,
         keys={"active": wif, "owner": wif2, "memo": wif3},
         num_retries=10)
     cls.account = Account("test", full=True, steem_instance=cls.bts)
Exemplo n.º 7
0
    def test_default_connection(self):
        b1 = Steem(
            node=["wss://testnet.steem.vc"],
            nobroadcast=True,
        )
        set_shared_steem_instance(b1)
        test = Account("test")

        b2 = Steem(
            node=get_node_list(appbase=False),
            nobroadcast=True,
        )
        set_shared_steem_instance(b2)

        bts = Account("test")

        self.assertEqual(test.steem.prefix, "STX")
        self.assertEqual(bts.steem.prefix, "STM")
Exemplo n.º 8
0
def checkacc(username):
    try:
        acc = Account(username, steem_instance=stmf)
    except Exception as exception:
        assert type(exception).__name__ == 'AccountDoesNotExistsException'
        assert exception.__class__.__name__ == 'AccountDoesNotExistsException'
        return False
    else:
        return True
Exemplo n.º 9
0
    def setUpClass(cls):
        nodelist = NodeList()
        cls.bts = Steem(node=nodelist.get_nodes(appbase=False),
                        nobroadcast=True,
                        unsigned=True,
                        data_refresh_time_seconds=900,
                        num_retries=10)
        cls.appbase = Steem(node=nodelist.get_nodes(normal=False,
                                                    appbase=True),
                            nobroadcast=True,
                            unsigned=True,
                            data_refresh_time_seconds=900,
                            num_retries=10)

        cls.account = Account("test", full=True, steem_instance=cls.bts)
        cls.account_appbase = Account("test",
                                      full=True,
                                      steem_instance=cls.appbase)
Exemplo n.º 10
0
 def test_account(self, node_param):
     if node_param == "instance":
         stm = Steem(node="abc", autoconnect=False, num_retries=1)
         set_shared_steem_instance(self.bts)
         acc = Account("test")
         self.assertIn(acc.steem.rpc.url, self.urls)
         self.assertIn(acc["balance"].steem.rpc.url, self.urls)
         with self.assertRaises(NumRetriesReached):
             Account("test", steem_instance=stm)
     else:
         set_shared_steem_instance(
             Steem(node="abc", autoconnect=False, num_retries=1))
         stm = self.bts
         acc = Account("test", steem_instance=stm)
         self.assertIn(acc.steem.rpc.url, self.urls)
         self.assertIn(acc["balance"].steem.rpc.url, self.urls)
         with self.assertRaises(NumRetriesReached):
             Account("test")
Exemplo n.º 11
0
def get_friends(username, follow_type):
    # Create account object
    try:
        account = Account(username)
        logging.warning(account)
    except Exception as e:
        logging.warning(e)
        return {}

    followers = account.get_followers()
    following = account.get_following()

    if follow_type == 'follower':
        return make_dict(followers, following)
    elif follow_type == 'following':
        return make_dict(following, followers)
    else:
        return {}
Exemplo n.º 12
0
    def upload(self, image, account, image_name=None):
        """ Uploads an image

            :param image: path to the image or image in bytes representation which should be uploaded
            :type image: str, bytes
            :param str account: Account which is used to upload. A posting key must be provided.
            :param str image_name: optional

            .. code-block:: python

                from beem import Steem
                from beem.imageuploader import ImageUploader
                stm = Steem(keys=["5xxx"]) # private posting key
                iu = ImageUploader(steem_instance=stm)
                iu.upload("path/to/image.png", "account_name") # "private posting key belongs to account_name

        """
        account = Account(account, steem_instance=self.steem)
        if "posting" not in account:
            account.refresh()
        if "posting" not in account:
            raise AssertionError("Could not access posting permission")
        for authority in account["posting"]["key_auths"]:
            posting_wif = self.steem.wallet.getPrivateKeyForPublicKey(authority[0])

        if isinstance(image, string_types):
            image_data = open(image, 'rb').read()
        elif isinstance(image, io.BytesIO):
            image_data = image.read()
        else:
            image_data = image

        message = py23_bytes(self.challenge, "ascii") + image_data
        signature = sign_message(message, posting_wif)
        signature_in_hex = hexlify(signature).decode("ascii")

        files = {image_name or 'image': image_data}
        url = "%s/%s/%s" % (
            self.base_url,
            account["name"],
            signature_in_hex
        )
        r = requests.post(url, files=files)
        return r.json()
Exemplo n.º 13
0
    def verify(self, **kwargs):
        """ Verify a message with an account's memo key

            :param str account: (optional) the account that owns the bet
                (defaults to ``default_account``)

            :returns: True if the message is verified successfully

            :raises InvalidMessageSignature: if the signature is not ok

        """
        # Split message into its parts
        parts = re.split("|".join(MESSAGE_SPLIT), self.message)
        parts = [x for x in parts if x.strip()]

        if not len(parts) > 2:
            raise AssertionError("Incorrect number of message parts")

        message = parts[0].strip()
        signature = parts[2].strip()
        # Parse the meta data
        meta = dict(re.findall(r'(\S+)=(.*)', parts[1]))

        # Ensure we have all the data in meta
        if "account" not in meta:
            raise AssertionError()
        if "memokey" not in meta:
            raise AssertionError()
        if "block" not in meta:
            raise AssertionError()
        if "timestamp" not in meta:
            raise AssertionError()

        # Load account from blockchain
        account = Account(meta.get("account"),
                          blockchain_instance=self.blockchain)

        # Test if memo key is the same as on the blockchain
        if not account["memo_key"] == meta["memokey"]:
            log.error("Memo Key of account {} on the Blockchain".format(
                account["name"]) +
                      "differs from memo key in the message: {} != {}".format(
                          account["memo_key"], meta["memokey"]))

        # Reformat message
        message = SIGNED_MESSAGE_META.format(**locals())

        # Verify Signature
        pubkey = verify_message(message, unhexlify(signature))

        # Verify pubky
        pk = PublicKey(hexlify(pubkey).decode("ascii"))
        if format(pk, self.blockchain.prefix) != meta["memokey"]:
            raise InvalidMessageSignature

        return True
Exemplo n.º 14
0
    def setUpClass(cls):
        cls.nodelist = NodeList()
        cls.nodelist.update_nodes(steem_instance=Steem(
            node=cls.nodelist.get_nodes(hive=True), num_retries=10))
        stm = Steem(node=cls.nodelist.get_nodes(hive=True))
        stm.config.refreshBackup()
        stm.set_default_nodes(["xyz"])
        del stm

        cls.urls = cls.nodelist.get_nodes(hive=True)
        cls.bts = Steem(node=cls.urls, nobroadcast=True, num_retries=10)
        set_shared_steem_instance(cls.bts)
        acc = Account("fullnodeupdate", steem_instance=cls.bts)
        comment = Comment(acc.get_blog_entries(limit=20)[-1],
                          steem_instance=cls.bts)
        cls.authorperm = comment.authorperm
        votes = comment.get_votes()
        last_vote = votes[-1]
        cls.authorpermvoter = comment['authorperm'] + '|' + last_vote["voter"]
Exemplo n.º 15
0
 def test_allow(self):
     bts = self.bts
     self.assertIn(bts.prefix, "STX")
     acc = Account("beem", steem_instance=bts)
     self.assertIn(acc.steem.prefix, "STX")
     tx = acc.allow(
         "STX55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n",
         account="beem",
         weight=1,
         threshold=1,
         permission="active",
     )
     self.assertEqual((tx["operations"][0][0]), "account_update")
     op = tx["operations"][0][1]
     self.assertIn("active", op)
     self.assertIn(
         ["STX55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n", '1'],
         op["active"]["key_auths"])
     self.assertEqual(op["active"]["weight_threshold"], 1)
Exemplo n.º 16
0
 def __init__(self, account, api=None, steem_instance=None):
     if api is None:
         self.api = Api()
     else:
         self.api = api
     self.ssc_id = "ssc-mainnet1"
     self.steem = steem_instance or shared_steem_instance()
     check_account = Account(account, steem_instance=self.steem)
     self.account = check_account["name"]
     self.refresh()
Exemplo n.º 17
0
def get_user_posts(username, from_id, limit=100):
    stm = Steem("https://steemd.privex.io")
    acc = Account(username, steem_instance=stm)

    blog_entries = acc.get_blog_entries(from_id, limit)

    entries_list = []

    for entry in blog_entries:
        if username == entry['author']:
            comment = Comment("@" + entry['author'] + "/" + entry['permlink'])
            entry_dict = {
                'id':
                comment.id,
                'title':
                comment.title,
                'clickable':
                'https://www.steemit.com/{0}/@{1}/{2}'.format(
                    comment.category,
                    comment.author,
                    comment.permlink,
                ),
                'url':
                '/{0}/@{1}/{2}'.format(
                    comment.category,
                    comment.author,
                    comment.permlink,
                ),
                'author':
                comment.author,
                'category':
                comment.category,
                'tags':
                comment.json_metadata['tags'],
                'entry_id':
                entry['entry_id']
            }

            if 'images' in comment.json_metadata:
                entry_dict['images'] = comment.json_metadata['images']
            entries_list.append(entry_dict)

    return entries_list
Exemplo n.º 18
0
    def test_default_connection(self):
        nodelist = NodeList()
        b1 = Steem(
            node=nodelist.get_testnet(),
            nobroadcast=True,
        )
        set_shared_steem_instance(b1)
        test = Account("test")

        b2 = Steem(
            node=nodelist.get_nodes(appbase=False),
            nobroadcast=True,
        )
        set_shared_steem_instance(b2)

        bts = Account("test")

        self.assertEqual(test.steem.prefix, "STX")
        self.assertEqual(bts.steem.prefix, "STM")
Exemplo n.º 19
0
    def setUpClass(cls):
        cls.nodelist = NodeList()
        cls.nodelist.update_nodes(steem_instance=Steem(
            node=cls.nodelist.get_nodes(normal=True, appbase=True),
            num_retries=10))
        stm = Steem(node=cls.nodelist.get_nodes())
        stm.config.refreshBackup()
        stm.set_default_nodes(["xyz"])
        del stm

        cls.urls = cls.nodelist.get_nodes()
        cls.bts = Steem(node=cls.urls, nobroadcast=True, num_retries=10)
        set_shared_steem_instance(cls.bts)
        acc = Account("holger80", steem_instance=cls.bts)
        comment = acc.get_blog(limit=20)[-1]
        cls.authorperm = comment.authorperm
        votes = acc.get_account_votes()
        last_vote = votes[-1]
        cls.authorpermvoter = '@' + last_vote['authorperm'] + '|' + acc["name"]
Exemplo n.º 20
0
    def setUpClass(cls):
        node_list = get_hive_nodes()

        cls.bts = Hive(node=node_list,
                       use_condenser=True,
                       nobroadcast=True,
                       unsigned=True,
                       keys={"active": wif},
                       num_retries=10)

        acc = Account("fullnodeupdate", blockchain_instance=cls.bts)
        comment = Comment(acc.get_blog_entries(limit=5)[1],
                          blockchain_instance=cls.bts)
        cls.authorperm = comment.authorperm
        [author, permlink] = resolve_authorperm(cls.authorperm)
        cls.author = author
        cls.permlink = permlink
        cls.category = comment.category
        cls.title = comment.title
 def check_account_on_activity(self, account, timestamp):
     if account not in self.accounts:
         return
     acc = Account(account, blockchain_instance=self.hive)
     self.accounts[account]["rc"] = acc.get_rc_manabar()["current_mana"]
     self.accounts[account]["hp"] = acc.get_token_power(only_own_vests=True)
     self.accounts[account]["rc_comments"] = self.accounts[account][
         "rc"] / self.comment_rc_costs
     store_data(self.data_file, "accounts", self.accounts)
     if self.accounts[account]["delegated_hp"] > 0:
         return
     if self.accounts[account]["delegation_revoked"]:
         return
     if self.accounts[account]["hp"] > self.config["maxUserHP"]:
         return
     if self.accounts[account]["rc_comments"] < self.config["minPostRC"]:
         ok = self.add_delegation(account, timestamp)
         if ok:
             self.notify_account(account, self.config["delegationMsg"])
Exemplo n.º 22
0
def stop_powerdown(account):
    """Stop power-down for ACCOUNT.

    """
    acc = Account(account.replace("@", ""))
    if acc['next_vesting_withdrawal'] in time_unset:
        logger.error("@%s is not powering down - nothing to do." %
                     (acc['name']))
        return
    pwd = getpass("Enter master password or active key for @%s: " %
                  (acc['name']))
    pk = passwordkey_to_key(pwd,
                            acc['name'],
                            role="active",
                            prefix=acc.blockchain.prefix)
    acc.blockchain.wallet.setKeys([pk])
    tx = acc.withdraw_vesting(0, account=acc['name'])
    logger.debug(tx)
    logger.info("Stopped power-down for @%s" % (acc['name']))
Exemplo n.º 23
0
async def on_ready():
    global queueing
    sfr = Account(sfr_name,steem_instance=stm)
    queue_length = cursor.execute('SELECT count(*) FROM steemflagrewards WHERE queue == 1;').fetchone()
    if sfr.vp < queue_vp or queue_length[0] > 0:
        flag_comment_review = bot.get_channel(
            FLAG_APPROVAL_CHANNEL_ID)
        await flag_comment_review.send(
            f'Either the VP is below {queue_vp} or there are unvoted queued mentions. Going into queue mode.')
        queueing = True
        await queue_voting(flag_comment_review, sfr)
Exemplo n.º 24
0
    def setUpClass(cls):
        nodelist = NodeList()
        nodelist.update_nodes(steem_instance=Steem(
            node=nodelist.get_nodes(hive=True), num_retries=10))
        cls.bts = Steem(node=nodelist.get_nodes(hive=True),
                        nobroadcast=True,
                        unsigned=True,
                        data_refresh_time_seconds=900,
                        num_retries=10)

        cls.account = Account("test", full=True, steem_instance=cls.bts)
Exemplo n.º 25
0
 def setUpClass(cls):
     cls.nodelist = NodeList()
     cls.nodelist.update_nodes(steem_instance=Steem(node=cls.nodelist.get_steem_nodes(), num_retries=10))
     cls.bts = Steem(
         node=cls.nodelist.get_steem_nodes(),
         nobroadcast=True,
         unsigned=True,
         data_refresh_time_seconds=900,
         keys={"active": wif, "owner": wif2, "memo": wif3},
         num_retries=10)
     cls.account = Account("test", full=True, steem_instance=cls.bts)
Exemplo n.º 26
0
def check_account(to):
    try:
        account = Account(to)
    except TypeError:
        #print(err)
        return -1
    except AccountDoesNotExistsException:
        return -1
    except ApiNotSupported:
        return -2
    return 0
Exemplo n.º 27
0
    def test_default_connection(self):
        nodelist = NodeList()
        nodelist.update_nodes(steem_instance=Hive(node=nodelist.get_hive_nodes(), num_retries=10))

        b2 = Hive(
            node=nodelist.get_hive_nodes(),
            nobroadcast=True,
        )
        set_shared_steem_instance(b2)
        bts = Account("beem")
        self.assertEqual(bts.blockchain.prefix, "STM")
Exemplo n.º 28
0
def change_recovery_account(account, new_recovery_account):
    """ Change the recovery account of ACCOUNT to NEW_RECOVERY_ACCOUNT.

    """
    acc = Account(account.replace("@", ""))
    # Account() lookup to ensure that the account exists
    new_rec = Account(new_recovery_account)
    logger.info("About to change recovery account of @%s from %s to %s" %
                (acc['name'], acc['recovery_account'], new_rec['name']))
    pwd = getpass("Enter master password or owner key for @%s: " %
                  (acc['name']))
    pk = passwordkey_to_key(pwd,
                            acc['name'],
                            role="owner",
                            prefix=acc.blockchain.prefix)
    acc.blockchain.wallet.setKeys([pk])
    tx = acc.change_recovery_account(new_rec)
    logger.debug(tx)
    logger.info("Recovery account change request to @%s will be active " \
                "in 30 days" % (new_rec['name']))
Exemplo n.º 29
0
 def __init__(self,
              account,
              tag=None,
              keyword=None,
              limit=None,
              days=None,
              reblog=False):
     self.username = account
     try:
         self.account = Account(account)
         self.exists = True
     except:
         logger.info("account @{} doesn't exist".format(account))
         self.exists = False
     self.tag = tag
     self.keyword = keyword  # and keyword.decode('utf-8')
     self.limit = int(limit) if limit else None
     self.days = float(days) if days else None
     self.reblog = reblog or False
     self.total = None
Exemplo n.º 30
0
 def test_account(self, node_param):
     if node_param == "instance":
         set_shared_steem_instance(self.bts)
         acc = Account("test")
         self.assertIn(acc.blockchain.rpc.url, self.urls)
         self.assertIn(acc["balance"].blockchain.rpc.url, self.urls)
         with self.assertRaises(RPCConnection):
             Account("test",
                     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
         acc = Account("test", steem_instance=stm)
         self.assertIn(acc.blockchain.rpc.url, self.urls)
         self.assertIn(acc["balance"].blockchain.rpc.url, self.urls)
         with self.assertRaises(RPCConnection):
             Account("test")