def _getToken(self, CorpNum): try: token = self.__tokenCache[CorpNum] except KeyError: token = None refreshToken = True if token != None: refreshToken = token.expiration[:-5] < linkhub.getTime() if refreshToken: try: token = linkhub.generateToken( self.__linkID, self.__secretKey, ServiceID_TEST if self.IsTest else ServiceID_REAL, CorpNum, self.__scopes) try: del self.__tokenCache[CorpNum] except KeyError: pass self.__tokenCache[CorpNum] = token except LinkhubException as LE: raise PopbillException(LE.code, LE.message) return token
def _getToken(self, ClientCode): try: token = self.__tokenCache[ClientCode] except KeyError: token = None refreshToken = True if token != None: refreshToken = token.expiration[:-5] < linkhub.getTime() if refreshToken: try: token = linkhub.generateToken( self.__linkID, self.__secretKey, ServiceID, ClientCode, self.__scopes, None if self.IPRestrictOnOff else "*") try: del self.__tokenCache[ClientCode] except KeyError: pass self.__tokenCache[ClientCode] = token except LinkhubException as LE: raise KakaocertException(LE.code, LE.message) return token
def _getToken(self): try: token = self.__tokenCache except KeyError : token = None refreshToken = True if token != None : refreshToken = token.expiration[:-5] < linkhub.getTime() if refreshToken : try: token = linkhub.generateToken(self.__linkID,self.__secretKey, ServiceID, None, self.__scopes) self.__tokenCache = token except LinkhubException as LE: raise CloseDownException(LE.code,LE.message) return token
def _getToken(self): try: token = self.__tokenCache except KeyError: token = None refreshToken = True if token != None: refreshToken = token.expiration[:-5] < linkhub.getTime() if refreshToken: try: token = linkhub.generateToken(self.__linkID, self.__secretKey, ServiceID, None, self.__scopes) self.__tokenCache = token except LinkhubException as LE: raise JusolinkException(LE.code, LE.message) return token
def setUp(self): self.token = linkhub.generateToken( 'TESTER', 'SwWxqU+0TErBXy/9TVjIPEnI0VTUMMSQZtJf3Ed8q3I=', 'POPBILL_TEST', '1231212312', ['member', '110'])