diff --git a/beem/account.py b/beem/account.py index 9919f39e805c16e14253f49a8be1899d4b869c0b..a023e768afd380a793147f17347de778c335fdea 100644 --- a/beem/account.py +++ b/beem/account.py @@ -733,11 +733,11 @@ class Account(BlockchainObject): """ return addTzInfo(datetime.utcnow()) + self.get_manabar_recharge_timedelta(manabar, recharge_pct_goal) - def get_feed(self, start_entry_id=0, limit=100, raw_data=False, short_entries=False, account=None): + def get_feed(self, start_entry_id=0, limit=20, raw_data=False, short_entries=False, account=None): """ Returns a list of items in an account’s feed :param int start_entry_id: default is 0 - :param int limit: default is 100 + :param int limit: default is 20 :param bool raw_data: default is False :param bool short_entries: when set to True and raw_data is True, get_feed_entries is used istead of get_feed :param str account: When set, a different account name is used (Default is object account name) @@ -773,7 +773,7 @@ class Account(BlockchainObject): c for c in d.get_discussions("feed", q, limit=limit, raw_data=raw_data) ] - def get_feed_entries(self, start_entry_id=0, limit=100, raw_data=True, + def get_feed_entries(self, start_entry_id=0, limit=20, raw_data=True, account=None): """ Returns a list of entries in an account’s feed @@ -800,12 +800,12 @@ class Account(BlockchainObject): """ return self.get_feed(start_entry_id=start_entry_id, limit=limit, raw_data=raw_data, short_entries=True, account=account) - def get_blog_entries(self, start_entry_id=0, limit=100, raw_data=True, + def get_blog_entries(self, start_entry_id=0, limit=20, raw_data=True, account=None): """ Returns the list of blog entries for an account :param int start_entry_id: default is 0 - :param int limit: default is 100 + :param int limit: default is 20 :param bool raw_data: default is False :param str account: When set, a different account name is used (Default is object account name) @@ -827,11 +827,11 @@ class Account(BlockchainObject): """ return self.get_blog(start_entry_id=start_entry_id, limit=limit, raw_data=raw_data, short_entries=True, account=account) - def get_blog(self, start_entry_id=0, limit=100, raw_data=False, short_entries=False, account=None): + def get_blog(self, start_entry_id=0, limit=20, raw_data=False, short_entries=False, account=None): """ Returns the list of blog entries for an account :param int start_entry_id: default is 0 - :param int limit: default is 100 + :param int limit: default is 20 :param bool raw_data: default is False :param bool short_entries: when set to True and raw_data is True, get_blog_entries is used istead of get_blog :param str account: When set, a different account name is used (Default is object account name) @@ -3612,7 +3612,7 @@ class Account(BlockchainObject): start_permlink = None start_author = None while True: - query_limit = 100 + query_limit = 20 if limit is not None and reblogs: query_limit = min(limit - post_count + 1, query_limit) @@ -3679,7 +3679,7 @@ class Account(BlockchainObject): comment_count = 0 while True: - query_limit = 100 + query_limit = 20 if limit is not None: query_limit = min(limit - comment_count + 1, query_limit) from .discussions import Discussions_by_comments diff --git a/beem/comment.py b/beem/comment.py index a5c832cb4f703d1154dc18f2deafbe86058ecb7b..899ebe8b8c91c23c6491a818503fcd398bb60ed6 100644 --- a/beem/comment.py +++ b/beem/comment.py @@ -850,7 +850,7 @@ class RecentReplies(list): Default: True :param Steem blockchain_instance: Steem() instance to use when accesing a RPC """ - def __init__(self, author, skip_own=True, start_permlink="", limit=100, lazy=False, full=True, blockchain_instance=None, **kwargs): + def __init__(self, author, skip_own=True, start_permlink="", limit=20, lazy=False, full=True, blockchain_instance=None, **kwargs): if blockchain_instance is None: if kwargs.get("steem_instance"): blockchain_instance = kwargs["steem_instance"] @@ -894,7 +894,7 @@ class RankedPosts(list): :param str start_permlink: start permlink :param Steem blockchain_instance: Steem() instance to use when accesing a RPC """ - def __init__(self, sort, tag="", observer="", limit=21, start_author="", start_permlink="", lazy=False, full=True, raw_data=False, blockchain_instance=None, **kwargs): + def __init__(self, sort, tag="", observer="", limit=20, start_author="", start_permlink="", lazy=False, full=True, raw_data=False, blockchain_instance=None, **kwargs): if blockchain_instance is None: if kwargs.get("steem_instance"): blockchain_instance = kwargs["steem_instance"] @@ -905,8 +905,8 @@ class RankedPosts(list): return None comments = [] api_limit = limit - if api_limit > 100: - api_limit = 100 + if api_limit > 20: + api_limit = 20 last_n = -1 while len(comments) < limit and last_n != len(comments): last_n = len(comments) @@ -928,7 +928,7 @@ class RankedPosts(list): if len(comments) > 0: start_author = comments[-1]["author"] start_permlink = comments[-1]["permlink"] - if limit - len(comments) < 100: + if limit - len(comments) < 20: api_limit = limit - len(comments) + 1 super(RankedPosts, self).__init__(comments) @@ -955,8 +955,8 @@ class AccountPosts(list): return None comments = [] api_limit = limit - if api_limit > 100: - api_limit = 100 + if api_limit > 20: + api_limit = 20 last_n = -1 while len(comments) < limit and last_n != len(comments): last_n = len(comments) @@ -978,6 +978,6 @@ class AccountPosts(list): if len(comments) > 0: start_author = comments[-1]["author"] start_permlink = comments[-1]["permlink"] - if limit - len(comments) < 100: + if limit - len(comments) < 20: api_limit = limit - len(comments) + 1 super(AccountPosts, self).__init__(comments) \ No newline at end of file diff --git a/beem/community.py b/beem/community.py index 57c542b503e5b18e7fb0ce3cc379f12791304137..32c9e67c614e293621d7b5f276dbf00680ea46d0 100644 --- a/beem/community.py +++ b/beem/community.py @@ -185,7 +185,7 @@ class Community(BlockchainObject): self.blockchain.rpc.set_next_node_on_empty_reply(False) return self.blockchain.rpc.account_notifications({"account": community, "limit": limit, "last_id": last_id}, api="bridge") - def get_ranked_posts(self, observer=None, limit=100, start_author=None, start_permlink=None, sort="created"): + def get_ranked_posts(self, observer=None, limit=20, start_author=None, start_permlink=None, sort="created"): """ Returns community post """ community = self["name"] diff --git a/beem/discussions.py b/beem/discussions.py index d9598c3ca462a3ef065b9466d14864b40c58656a..08ed1188a57276ab6d41095ccd13b5fd7b5c222d 100644 --- a/beem/discussions.py +++ b/beem/discussions.py @@ -69,7 +69,7 @@ class Discussions(object): self.lazy = lazy self.use_appbase = use_appbase - def get_discussions(self, discussion_type, discussion_query, limit=1000, raw_data=False): + def get_discussions(self, discussion_type, discussion_query, limit=20, raw_data=False): """ Get Discussions :param str discussion_type: Defines the used discussion query @@ -83,14 +83,14 @@ class Discussions(object): query = Query(limit=51, tag="steemit") discussions = Discussions() count = 0 - for d in discussions.get_discussions("tags", query, limit=200): + for d in discussions.get_discussions("tags", query, limit=20): print(("%d. " % (count + 1)) + str(d)) count += 1 """ - if limit >= 100 and discussion_query["limit"] == 0: - discussion_query["limit"] = 100 - elif limit < 100 and discussion_query["limit"] == 0: + if limit >= 20 and discussion_query["limit"] == 0: + discussion_query["limit"] = 20 + elif limit < 20 and discussion_query["limit"] == 0: discussion_query["limit"] = limit query_count = 0 found_more_than_start_entry = True @@ -263,7 +263,7 @@ class Discussions_by_author_before_date(list): print(h) """ - def __init__(self, author="", start_permlink="", before_date="1970-01-01T00:00:00", limit=100, lazy=False, use_appbase=False, raw_data=False, blockchain_instance=None, **kwargs): + def __init__(self, author="", start_permlink="", before_date="1970-01-01T00:00:00", limit=20, lazy=False, use_appbase=False, raw_data=False, blockchain_instance=None, **kwargs): if blockchain_instance is None: if kwargs.get("steem_instance"): blockchain_instance = kwargs["steem_instance"] diff --git a/tests/beem/test_comment.py b/tests/beem/test_comment.py index ab4222bb019b243283150461f08754ed4ad52ae4..13d217c83cbc7eb4dbac80d81581c01d1383d4bb 100644 --- a/tests/beem/test_comment.py +++ b/tests/beem/test_comment.py @@ -253,19 +253,19 @@ class Testcases(unittest.TestCase): def test_ranked_posts(self): bts = self.bts - r = RankedPosts(sort="trending", limit=102, blockchain_instance=bts) - self.assertTrue(len(r) == 102) + r = RankedPosts(sort="trending", limit=18, blockchain_instance=bts) + self.assertTrue(len(r) == 18) self.assertTrue(r[0] is not None) - r = RankedPosts(sort="trending", limit=102, raw_data=True, blockchain_instance=bts) - self.assertTrue(len(r) == 102) + r = RankedPosts(sort="trending", limit=19, raw_data=True, blockchain_instance=bts) + self.assertTrue(len(r) == 19) self.assertTrue(r[0] is not None) def test_account_posts(self): bts = self.bts - r = AccountPosts("feed", "holger80", limit=102, blockchain_instance=bts) - self.assertTrue(len(r) == 102) + r = AccountPosts("feed", "holger80", limit=18, blockchain_instance=bts) + self.assertTrue(len(r) == 18) self.assertTrue(r[0] is not None) - r = AccountPosts("feed", "holger80", limit=102, raw_data=True, blockchain_instance=bts) - self.assertTrue(len(r) == 102) \ No newline at end of file + r = AccountPosts("feed", "holger80", limit=19, raw_data=True, blockchain_instance=bts) + self.assertTrue(len(r) == 19) \ No newline at end of file