variables - Python: Store Token in Memory -


i have class , in class have function performs authentication , returns token.

i store token in memory use other functions in same class.

how ?

presuming structure this:

class myclass(object):   def doauth(self):     callauthprocedure() 

if callauthprocedure returns token, adjust this:

class myclass(object):   def doauth(self):     self.token = callauthprocedure() 

later, other methods on instance of class can use self.token necessary.


Comments

Popular posts from this blog

Python __call__ special method practical example -

arrays - jQuery - Retrieve values from HTML elements and return their sum -