Skip to content

Commit 8acde69

Browse files
committed
[ADD] *_system_http: add put interface
1 parent ac72ab7 commit 8acde69

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

base_external_system_http/models/external_system_interaction_mixin.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ def post(self, endpoint=None, data=None, json=None, **kwargs):
3535
response = requests.post(url, data=data, json=json, timeout=timeout, **kwargs)
3636
return self._return_checked_response(endpoint, response)
3737

38+
def put(self, endpoint=None, data=None, json=None, **kwargs):
39+
"""Post data to http server."""
40+
url = self._get_url(endpoint=endpoint)
41+
_logger.debug("Will post data to %s", url)
42+
timeout = kwargs.pop("timeout", 60) # default timeout a full minute.
43+
response = requests.put(url, data=data, json=json, timeout=timeout, **kwargs)
44+
return self._return_checked_response(endpoint, response)
45+
3846
def _get_url(self, endpoint=None, url_suffix=None):
3947
"""Make full url for endpoint.
4048

0 commit comments

Comments
 (0)