Code in PHP I need to move to python
[md5 key] = md5( ( [Request Timestamp] % [Registration Window] ) . [salt] );
Example:
<?php
function get_md5_hash($strDatetime, $strAuthWindow, $strSalt) {
return md5((strtotime($strDatetime) % ((int)$strAuthWindow)) .$strSalt);
}
print get_md5_hash("2013-04-29T20:51:29GMT+0300", "604800", "155961");
?>
Python code this far
timestamp = datetime.datetime.now() - timedelta(hours=6)
timestamp_str = '{:%Y-%m-%dT%H:%M:%S}'.format(timestamp)
salt = "454243"
registration_window = "604800"
import hashlib
md5_key = hashlib.md5(((timestamp_str % registration_window) .salt).encode('utf-8')).hexdigest()
I can't get past this error message:
TypeError: not all arguments converted during string formatting