diff --git a/beem/account.py b/beem/account.py index 0cb45384da18180aececa254d1b7ea27bfeaf337..1531e82fea7914c439bc24f7c104bbf4b5f21109 100644 --- a/beem/account.py +++ b/beem/account.py @@ -2605,7 +2605,7 @@ class Account(BlockchainObject): tag=account['name']) results = Discussions_by_feed(query, steem_instance=self.steem) if len(results) == 0 or (start_permlink and len(results) == 1): - raise StopIteration + return if feed_count > 0 and start_permlink: results = results[1:] # strip duplicates from previous iteration for entry in results: @@ -2614,7 +2614,7 @@ class Account(BlockchainObject): start_permlink = entry['permlink'] start_author = entry['author'] if feed_count == limit: - raise StopIteration + return def blog_history(self, limit=None, start=-1, reblogs=True, account=None): """ stream the blog entries done by an account in reverse time order. @@ -2674,7 +2674,7 @@ class Account(BlockchainObject): results = Discussions_by_blog(query, steem_instance=self.steem) if len(results) == 0 or (start_permlink and len(results) == 1): - raise StopIteration + return if start_permlink: results = results[1:] # strip duplicates from previous iteration for post in results: @@ -2686,7 +2686,7 @@ class Account(BlockchainObject): start_permlink = post['permlink'] start_author = post['author'] if post_count == limit: - raise StopIteration + return def comment_history(self, limit=None, start_permlink=None, account=None): @@ -2736,7 +2736,7 @@ class Account(BlockchainObject): results = Discussions_by_comments(query, steem_instance=self.steem) if len(results) == 0 or (start_permlink and len(results) == 1): - raise StopIteration + return if comment_count > 0 and start_permlink: results = results[1:] # strip duplicates from previous iteration for comment in results: @@ -2746,7 +2746,7 @@ class Account(BlockchainObject): yield comment start_permlink = comment['permlink'] if comment_count == limit: - raise StopIteration + return def reply_history(self, limit=None, start_author=None, start_permlink=None, account=None): @@ -2808,7 +2808,7 @@ class Account(BlockchainObject): results = Replies_by_last_update(query, steem_instance=self.steem) if len(results) == 0 or (start_permlink and len(results) == 1): - raise StopIteration + return if reply_count > 0 and start_permlink: results = results[1:] # strip duplicates from previous iteration for reply in results: @@ -2819,7 +2819,7 @@ class Account(BlockchainObject): start_author = reply['author'] start_permlink = reply['permlink'] if reply_count == limit: - raise StopIteration + return class AccountsObject(list): diff --git a/beem/blockchain.py b/beem/blockchain.py index ccce7de3d229ff0eaeeb3870ee8cc6c3d255b44b..68c15f3e071f826431ca4959b5974c6f117c888a 100644 --- a/beem/blockchain.py +++ b/beem/blockchain.py @@ -550,7 +550,6 @@ class Blockchain(object): head_block_reached = True if stop and start > stop: - # raise StopIteration return # Sleep for one block @@ -824,12 +823,12 @@ class Blockchain(object): yield account_name cnt += 1 if account_name == stop or (limit > 0 and cnt > limit): - raise StopIteration + return if lastname == account_name: - raise StopIteration + return lastname = account_name if len(ret) < steps: - raise StopIteration + return def get_account_count(self): """ Returns the number of accounts""" @@ -869,12 +868,12 @@ class Blockchain(object): yield account cnt += 1 if account_name == stop or (limit > 0 and cnt > limit): - raise StopIteration + return if lastname == account_name: - raise StopIteration + return lastname = account_name if len(ret) < steps: - raise StopIteration + return def get_similar_account_names(self, name, limit=5): """ Returns limit similar accounts with name as list diff --git a/beemapi/graphenerpc.py b/beemapi/graphenerpc.py index 8e9c2b1a70d8b8b57f767604eba80f25c8d9b4ab..7ded2842e89ec72af32686375ead84ad72f3ead2 100644 --- a/beemapi/graphenerpc.py +++ b/beemapi/graphenerpc.py @@ -269,11 +269,17 @@ class GrapheneRPC(object): self.ws.close() def request_send(self, payload): - response = self.session.post(self.url, - data=payload, - headers=self.headers, - timeout=self.timeout, - auth=(self.user, self.password)) + if self.user is not None and self.password is not None: + response = self.session.post(self.url, + data=payload, + headers=self.headers, + timeout=self.timeout, + auth=(self.user, self.password)) + else: + response = self.session.post(self.url, + data=payload, + headers=self.headers, + timeout=self.timeout) if response.status_code == 401: raise UnauthorizedError return response.text