How to use the onedrivesdk.UploadSession function in onedrivesdk

To help you get started, we’ve selected a few onedrivesdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github epam / OneDrive-L / onedrive_service / src / onedrive_service / util.py View on Github external
"""
        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
github epam / OneDrive-L / onedrive_service / src / onedrive_service / util.py View on Github external
"""
        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