To get timestamp in JavaScript we use
var ts = new Date().getTime()
What is the proper way to convert it to a Python datetime
datetime
For others still getting an error: I had a similar issue but the unix timestamp was in microseconds, i.e. I had to divide the timestamp by 1000000 to get the correct result.
dt = datetime.datetime.fromtimestamp(1502360499615921)