def patch(self, restApi, data={}, silentMode=False): """ Description A HTTP PATCH function to modify configurations. Parameters restApi: The REST API URL. data: The data payload for the URL. silentMode: True or False. To display URL, data and header info. """ if silentMode == False: self.logInfo('\n\tPATCH: {0}\n\tDATA: {1}\n\tHEADERS: {2}'.format(restApi, data, self.jsonHeader)) try: response = requests.patch(restApi, data=json.dumps(data), headers=self.jsonHeader, verify=self.verifySsl) if silentMode == False: self.logInfo('\tSTATUS CODE: %s' % response.status_code, timestamp=False) if not str(response.status_code).startswith('2'): self.logError('Patch error:') raise IxLoadRestApiException('http PATCH error: {0}\n'.format(response.text)) return response except requests.exceptions.RequestException as errMsg: raise IxLoadRestApiException('http PATCH error: {0}\n'.format(errMsg))