Python:将令牌存储在内存中
我有一个类,并且在该类中,我有一个执行身份验证并返回令牌的函数。Python:将令牌存储在内存中
我想将该令牌存储在内存中供其他功能在同一个类中使用。
我该怎么做?
回答:
。假定这样的结构:
class myClass(object): def doAuth(self):
callAuthProcedure()
如果callAuthProcedure
回报的道理,简单地调整它这样做:
class myClass(object): def doAuth(self):
self.token = callAuthProcedure()
后来,在类的实例其他方法可以使用self.token
有必要的。
以上是 Python:将令牌存储在内存中 的全部内容, 来源链接: utcz.com/qa/267116.html