作品非常谢谢!
您可能需要修改这两行。
Python 2.7
散列= hmac。new(decoded_secret, sig_block, sha1) sig = hashed.digest().encode("base64").rstrip('\n')
Python 3. x
散列= hmac。new(decoded_secret, sig_block.encode(), sha1) sig = base64.b64encode(hashed.digest()).decode('utf-8')
也许你会发现使用2to3(一种python工具来自动翻译代码)是很有用的:https://docs.python.org/2/library/2to3.html
否则,这份文件可能会对你有帮助:https://docs.python.org/3/howto/pyporting.html