I'm trying to get a hash of a string:
hs = hashlib.sha256(get_some_string()).hexdigest()
...but I get an error:
TypeError: Unicode-objects must be encoded before hashing
Use utf-8 encoding:
hs = hashlib.sha256(get_some_string().encode('utf-8')).hexdigest()
To get more information read documentation.