gnupg 没有很好的文档记录,但是如果您检查它,您会看到除了通常使用的属性之外还有其他属性...
#234567891123456789212345678931234567894123456789512345678961234567897123456789
# core
import inspect
import pickle
import datetime
# 3rd party
import gnupg
def depickle():
""" pull and depickle our signed data """
f = open('pickle.txt', 'r')
signed_data = pickle.load(f)
f.close()
return signed_data
# depickle our signed data
signed_data = depickle()
# inspect the object
for key, value in inspect.getmembers(signed_data):
print key
其中之一是您的时间戳……恰如其分地命名为时间戳。既然你知道它,你可以很容易地使用它......
# use the attribute now that we know it
print signed_data.timestamp
# make it pretty
print datetime.datetime.fromtimestamp(float(signed_data.timestamp))
这感觉很啰嗦,但我认为这个讨论将受益于记录使用检查来识别未记录的属性,而不是仅仅说“使用 signed_data.timestamp”。