Exemple #1
0
 def test3_upload_file_session(self):
     file_name = "big_buck_bunny.mp4"
     local_path = "{0}/data/{1}".format(os.path.dirname(__file__),
                                        file_name)
     uploader = ResumableFileUpload(self.target_drive.root, local_path,
                                    1000000)
     uploader.execute()
     print("{0} bytes has been uploaded".format(0))
    def resumable_upload(self, source_path, chunk_size=1000000):
        """
        Create an upload session to allow your app to upload files up to the maximum file size.
        An upload session allows your app to upload ranges of the file in sequential API requests,
        which allows the transfer to be resumed if a connection is dropped while the upload is in progress.

        To upload a file using an upload session, there are two steps:
            Create an upload session
            Upload bytes to the upload session

        :param str source_path: Local file path
        :param int chunk_size: chunk size
        """
        uploader = ResumableFileUpload(self, source_path, chunk_size)
        return uploader.drive_item