def refreshAuth(self): auth_url = self.authUrl + "/api/platform/applications/authtickets/refresh-ticket"; headers = {'Content-type': 'application/json', 'Accept-Encoding': 'gzip, deflate'} auth_request = {'refreshToken' : self.auth["refreshToken"]}; auth_response = util.http_call(auth_url,"PUT", data=json.dumps(auth_request), headers=headers, verify=self.verifySSL); self.auth = auth_response.json();
def execute(self): self.validate(); logging.info("executing request using url : %s" % self.__resourceUrl.uri); self.__headers[Headers.X_VOL_APP_CLAIMS] = self.appAuth.getAccessToken(); self.__headers["Content-Type"] = self.__contentType; requestUrl = self.__baseAddress+self.__resourceUrl.uri; if self.__body is not None and self.__isJsonBody: self.__body = json.dumps(self.__body); self.response = util.http_call(requestUrl, self.__resourceUrl.verb,headers=self.__headers,data=self.__body, verify=self.verifySSLCert);
def authenticate(self): auth_url = self.authUrl + "/api/platform/applications/authtickets"; headers = {'Content-type': 'application/json', 'Accept-Encoding': 'gzip, deflate'} auth_request = {'applicationId' : self.applicationKey, 'sharedSecret' : self.sharedSecret}; auth_response = util.http_call(auth_url,"POST", data=json.dumps(auth_request), headers=headers, verify=self.verifySSL); self.auth = auth_response.json(); logging.info("Auth Token : %s" % self.auth["accessToken"]); logging.info("Refresh Token : %s" % self.auth["refreshToken"]); logging.info("Access Token Expiration: %s" % self.auth["accessTokenExpiration"]) logging.info("Refresh Token Expiration: %s" % self.auth["refreshTokenExpiration"])
def getTenant(self, tenantId: int): requestUrl = self.baseAuthUrl+"/api/platform/tenants/"+str(tenantId); headers = {}; headers[Headers.X_VOL_APP_CLAIMS] = self.appAuth.getAccessToken(); response = util.http_call(requestUrl,"GET", headers=headers, verify=self.verifySSLCert); return response.json();