Python Steem Library Breaks after Python3.8.14 (unsupported hash type ripemd160)

in witness-category •  2 years ago 

The official Steem Python library: https://github.com/steemit/steem-python seems no longer under maintenance.
From Python3.8.14 changes logs: https://docs.python.org/3.8/whatsnew/changelog.html
it says:

gh-95778: Converting between int and str in bases other than 2 (binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10 (decimal) now raises a ValueError if the number of digits in string form is above a limit to avoid potential denial of service attacks due to the algorithmic complexity. This is a mitigation for CVE-2020-10735.

I created a new VPS, ubuntu 22.04, and it comes with Python 3.10.4. I was running the following Python script to claim steem rewards:

def claim(user, key):
  global steem_nodes
  wif = {
      "posting": key
  }
  try:
    steem = Steem(nodes=steem_nodes,keys=wif)
    account = Account(user, steemd_instance=steem)
    sbd   = account.balances["rewards"]["SBD"]
    st    = account.balances["rewards"]["STEEM"]
    vests = account.balances["rewards"]["VESTS"]
    if sbd > 0 or st > 0 or vests > 0:
      print('claiming rewards for ' + user + " ...")
      steem.claim_reward_balance(account=user)
    else:
      print('nothing to claim for ' + user)
  except Exception as e:
    print("Unexpected error for " + user, sys.exc_info()[0])
    print(e)

And it says:
class 'ValueError': unsupported hash type ripemd160

image.png

Google leads to this SO page: https://stackoverflow.com/questions/72409563/unsupported-hash-type-ripemd160-with-hashlib-in-python

image.png

And it works!

image.png

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Great catch!