Skip to content

Commit 726e1f7

Browse files
author
Murat Kumykov
committed
execute_patch added to HubInstance per NXP
1 parent 61f333d commit 726e1f7

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

blackduck/Core.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,17 @@ def execute_put(self, url, data, custom_headers={}):
146146
response = requests.put(url, headers=headers, data=json_data, verify = not self.config['insecure'])
147147
return response
148148

149+
def execute_patch(self, url, data, custom_headers={}) -> requests.Response:
150+
'''
151+
Work-around to add missing execute_patch()
152+
'''
153+
json_data = self._validated_json_data(data)
154+
headers = self.get_headers()
155+
headers["Content-Type"] = "application/json"
156+
headers.update(custom_headers)
157+
response = requests.patch(url, headers=headers, data=json_data, verify=not self.config['insecure'])
158+
return response
159+
149160
def _create(self, url, json_body):
150161
response = self.execute_post(url, json_body)
151162
# v4+ returns the newly created location in the response headers

blackduck/HubRestApi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class HubInstance(object):
6868
_create,_get_hub_rest_api_version_info,_get_major_version,_get_parameter_string,_validated_json_data,
6969
execute_delete,execute_get,execute_post,execute_put,get_api_version,get_apibase,get_auth_token,get_headers,
7070
get_limit_paramstring,get_link,get_matched_components,get_tags_url,get_urlbase,read_config,write_config,
71-
_check_version_compatibility
71+
_check_version_compatibility,execute_patch
7272
)
7373
from .Roles import (
7474
_get_role_url, assign_role_given_role_url, assign_role_to_user_or_group,

0 commit comments

Comments
 (0)