From 1c04b5837d78eb97b424a766aec5998e3f481f8d Mon Sep 17 00:00:00 2001 From: Eric Ball Date: Thu, 28 May 2020 08:22:42 -0700 Subject: [PATCH] Fix string limit issue in _request_put_file Requests can't handle a put call for very large data objects. However, it can accept the data as a file-like object instead, and the size issue will not show up. Documented here: https://github.com/psf/requests/issues/2717. Issue: IT-19717 Change-Id: I826d3fa2eebbd3ba0389a0d7042701b4389e406d Signed-off-by: Eric Ball --- lftools/deploy.py | 2 +- releasenotes/notes/string-limit-fix-a04184d5280da421.yaml | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/string-limit-fix-a04184d5280da421.yaml diff --git a/lftools/deploy.py b/lftools/deploy.py index 15d181c2..a2875c20 100755 --- a/lftools/deploy.py +++ b/lftools/deploy.py @@ -156,7 +156,7 @@ def _request_put_file(url, file_to_upload, parameters=None): if parameters: resp = requests.put(url, data=parameters, files=files) else: - resp = requests.put(url, data=upload_file.read()) + resp = requests.put(url, data=upload_file) except requests.exceptions.MissingSchema: raise requests.HTTPError("Not valid URL format. Check for https:// etc..: {}".format(url)) except requests.exceptions.ConnectTimeout: diff --git a/releasenotes/notes/string-limit-fix-a04184d5280da421.yaml b/releasenotes/notes/string-limit-fix-a04184d5280da421.yaml new file mode 100644 index 00000000..5a68332f --- /dev/null +++ b/releasenotes/notes/string-limit-fix-a04184d5280da421.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Requests can't handle a put call for very large data objects. However, it + can accept the data as a file-like object instead, and the size issue will + not show up. Documented here: https://github.com/psf/requests/issues/2717. -- 2.16.6