Added headers to sunnylink upload requests

The sunnylink_uploader.py file was modified to include headers in the upload request. The headers are gathered from the 'headers' field in the URL response JSON and passed into the 'put' request method. The debug log message was also updated to display these headers along with the upload URL.
This commit is contained in:
DevTekVE
2024-05-29 11:28:12 +02:00
parent 4f5251f951
commit e053368ebf
+3 -2
View File
@@ -147,7 +147,8 @@ class Uploader:
url_resp_json = json.loads(url_resp.text)
url = url_resp_json['url']
cloudlog.debug("sunnylink upload_url %s", url)
headers = url_resp_json['headers']
cloudlog.debug("sunnylink upload_url %s | Headers: %s", url, headers)
if fake_upload:
return FakeResponse()
@@ -160,7 +161,7 @@ class Uploader:
else:
data = f
return requests.put(url, data=data, timeout=10)
return requests.put(url, data=data, headers=headers, timeout=10)
def upload(self, name: str, key: str, fn: str, network_type: int, metered: bool) -> bool:
try: