How to solve issues with Steem Python Due to Default Node Issues
During the last few days there has been some issues for many users running automated scripts that uses Steem. Due to some errors the default node is not responding properly or not at all.
Solution for Steem Python
Steem Pyton is a popular codebase to use for interacting with the steem blockchain.
The usual syntax is s = Steem()
or if you use a module b = Blockchain()
, a = Account()
etc.
Something that you don't have to think on otherwise is that the Steem()
class can take a list of access nodes to use before trying the default node. If one node fails it will try the next one and at the end it will use the default steemit node as a failsafe.
To use a set of specific set nodes you can add this to your code instead
nodes = ['https://gtg.steem.house:8090','https://seed.bitcoiner.me']
s = Steem(nodes)
b = Blockchain(s)
a = Account(s)
Prevent Script Execution Failure
To prevent the script from ending once a node sends bad data you can add something like this to your code
def myFunction():
try:
for operation in b.stream_from():
except Exception as e:
myFunction()
myFunction()