Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
data_length = len(data)
builder = onedrivesdk.ItemRequestBuilder(upload_url, self.client)
req = builder.request()
req.method = 'PUT'
# init header options
header_options = self._init_upload_session_header(next_range,
data_length, total)
for option in header_options:
req.append_option(option)
# send chunk of data
raw_response = req.send(data=data)
entity = onedrivesdk.UploadSession(json.loads(raw_response.content))
return entity
"""
Check the upload session status
You can request the status of the file at any time,
not just when the upload has failed.
The server will respond with a list of missing
byte ranges that need to be uploaded.
:param upload_url:
:return: onedrivesdk.UploadSession
"""
builder = onedrivesdk.ItemRequestBuilder(upload_url, self.client)
req = builder.request()
req.method = 'GET'
raw_response = json.loads(req.send().content)
entity = onedrivesdk.UploadSession(raw_response)
return entity