From f752a5455d4520788843646ec0c9a68b7d89af6a Mon Sep 17 00:00:00 2001 From: rlbr Date: Sat, 17 Nov 2018 21:11:09 -0600 Subject: [PATCH] yyfvbetbfwafbtwbwttbhqr partialg --- gapi/drive_api.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/gapi/drive_api.py b/gapi/drive_api.py index 6c82564..08b2d7c 100644 --- a/gapi/drive_api.py +++ b/gapi/drive_api.py @@ -71,14 +71,28 @@ class drive_api(API): def __upload_file__(self,local_path,remote_path): '''creates file if it does not exists otherwise update the file''' - isdir = os.path.isdir(local_path) + mimetype = from_file(local_path,mime_type=True) + _upload = MeduaFileUpload(local_path,mimeType=mimetype) try: fid = get_file_by_path(remote_path) + self.service.files().update(fileId=fid,mediaBody=_upload) except FileNotFoundError: path = split_path(remote_path) end = path.pop() parent = mkdirs(path) parent_id = parent[0]['id'] + meta = { + 'name':end, + 'parents':[parent_id] + } + new_f_meta = self.service.files().create( + body = meta, + mediaBody = _upload + ).execute() + parent['files']['end'] = new_f_meta + + + def mkdirs(self,path):