def auth(self): auTest = AuthenticationTest.AuthenticationTest() authentication = Authentication() ag = authentication.getAuthToken(Constant().clientInfo()) # print("====== get access token ======") # print("result:", ag + "\n") return ag
def refresh_auth(self): auTest = AuthenticationTest.AuthenticationTest() authentication = Authentication() # ag = authentication.getAuthToken(Constant().clientInfo()) # print("====== get access token ======") # print("result:", ag + "\n") ar = authentication.refreshAuthToken(auTest.refreshAuthTokenInfo()) # print("====== refresh token ======") # print("result:", ar + "\n") return ar
def refreshAuthTokenInfo(self): arInDTO = AuthRefreshInDTO() arInDTO.appId = (Constant().readConfFile())[2] arInDTO.secret = (Constant().readConfFile())[3] authOutDTO = AuthOutDTO() result = Authentication().getAuthToken(Constant().clientInfo()) authOutDTO.setRefreshToken(json.loads(result)['refreshToken']) arInDTO.refreshToken = authOutDTO.getRefreshToken() return arInDTO
qddhInDTO.deviceId = "bd6394ed-b41d-430d-85f8-5d0290cfee24" qddhInDTO.gatewayId = "bd6394ed-b41d-430d-85f8-5d0290cfee24" qddhInDTO.appId = "wk14orhpOumkAouraCpOsoQ3iO4a" return qddhInDTO def queryDeviceCapabilities(self): qdcInDTO = QueryDeviceCapabilitiesInDTO() qdcInDTO.deviceId = "bd6394ed-b41d-430d-85f8-5d0290cfee24" qdcInDTO.gatewayId = "bd6394ed-b41d-430d-85f8-5d0290cfee24" qdcInDTO.appId = "wk14orhpOumkAouraCpOsoQ3iO4a" return qdcInDTO if __name__ == "__main__": dcTest = DataCollectionTest() authentication = Authentication() dataCollection = DataCollection() # get accessToken at first result = authentication.getAuthToken(Constant().clientInfo()) authOutDTO = AuthOutDTO() authOutDTO.setAccessToken(json.loads(result)['accessToken']) accessToken = authOutDTO.getAccessToken() # query device info deviceId = "782eb286-9ead-424f-a910-c235b6090edc" dq = dataCollection.querySingleDeviceInfo(deviceId, None, None, accessToken) print("====== query device info ======") print("result:", dq + "\n")