Python Eveapi 转换到过期日期

2024-05-13 07:18:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在与eveapi合作的游戏Eve Online https://github.com/ntt/eveapihttp://wiki.eve-id.net/APIv2_Account_APIKeyInfo_XML

现在,我可以通过运行以下命令来获取API的过期日期:

import eveapi
api = eveapi.EVEAPIConnection()
auth = api.auth(keyID=4055832, vCode="W7LF0Q8mqgYGpAbLiZgeO6bCpQq1PZ4rbgvlt8nyM4Iy1giko38rAJtEE8WuJ5wT")
expires = auth.account.APIKeyInfo().key.expires

但它返回以下数字1453327533 我怎么才能把它变成真正的约会呢


Tags: httpsgithubcomauthapihttp游戏wiki
1条回答
网友
1楼 · 发布于 2024-05-13 07:18:19

数字是fromtimestamp(自UNIX epoch以来的秒数,1970年1月1日) 因此,要获得日期时间,只需执行以下操作:

from datetime import datetime
datetime.fromtimestamp(int(expires))

相关问题 更多 >