问题描述
要基于日期时间戳和6位整数值生成相同的一致UUid。 json文件作为事件发送。因此,希望为连接到同一日期时间戳的所有事件和输入文件中的6位整数值生成相同的UUid。
无法在python中做同样的事情。
解决方法
您可以使用uuid.uuid3():
import uuid
namespace_uuid = uuid.uuid4() # you need to store that one
# will always give the same uuid for the same timestamp and digits
uuid.uuid3(namespace_uuid,str(timestamp)+str(digits))