Answers for "Anybody have tips to update my python code to python 3?" https://knowledge.亚搏在线safe.com/questions/82306/anybody-have-tips-to-update-my-python-code-to-pyth.html The latest answers for the question "Anybody have tips to update my python code to python 3?" Answer by takashi https://knowledge.safe.com/answers/82322/view.html

Probably you will have to modify these two lines.

Python 2.7

hashed = hmac.new(decoded_secret, sig_block, sha1) sig = hashed.digest().encode("base64").rstrip('\n')

Python 3.x

hashed = hmac.new(decoded_secret, sig_block.encode(), sha1) sig = base64.b64encode(hashed.digest()).decode('utf-8')


Sat, 10 Nov 2018 13:50:12 GMT takashi
Answer by hollyatsafe https://knowledge.safe.com/answers/82314/view.html

Hi@johnglick,

Perhaps you might find it useful to use 2to3 - a python tool to automate code translation:https://docs.python.org/2/library/2to3.html

Else this doc may also be helpful to you:https://docs.python.org/3/howto/pyporting.html

Fri, 09 Nov 2018 23:33:14 GMT hollyatsafe