def getToken(self): """gets a token from file (if a previous sync has been performed), or opens a browser to request a new one (in which case the function returns true). NOTE: token is valid forever """ if self.token == None: self.config_dir = \ os.path.join(os.sys.path[0], 'config') self.token = self._smartLoadFromFile(self.config_dir, 'token') if self.token == None: self.rtm= createRTM(self.PUBLIC_KEY, self.PRIVATE_KEY) os.startfile(self.rtm.getAuthURL()) raw_input('Please press Enter once you gave access to this application on the RTM page opened on your default browser') return False return True
def getToken(self): """gets a token from file (if a previous sync has been performed), or opens a browser to request a new one (in which case the function returns true). NOTE: token is valid forever """ if self.token == None: self.config_dir = \ os.path.join(os.sys.path[0], 'config') self.token = self._smartLoadFromFile(self.config_dir, 'token') if self.token == None: self.rtm = createRTM(self.PUBLIC_KEY, self.PRIVATE_KEY) os.startfile(self.rtm.getAuthURL()) raw_input( 'Please press Enter once you gave access to this application on the RTM page opened on your default browser' ) return False return True
def login(self): if hasattr(self, 'rtm'): try: self.token = self.rtm.getToken() except: self.token = None if (self.getToken() == False): return False try: self.rtm = createRTM(self.PUBLIC_KEY, self.PRIVATE_KEY, \ self.token) except: self.token = None self._smartSaveToFile(self.config_dir, 'token', self.token) #NOTE: a timeline is an undo list for RTM. It can be used for # journaling(timeline rollback is atomical) self.timeline = self.rtm.timelines.create().timeline return True
def login(self): if hasattr(self, 'rtm'): try: self.token = self.rtm.getToken() except: self.token = None if(self.getToken() == False): return False try: self.rtm = createRTM(self.PUBLIC_KEY, self.PRIVATE_KEY, \ self.token) except: self.token = None self._smartSaveToFile(self.config_dir, 'token', self.token) #NOTE: a timeline is an undo list for RTM. It can be used for # journaling(timeline rollback is atomical) self.timeline = self.rtm.timelines.create().timeline return True