mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-09-29 15:03:43 +08:00
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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user