Skip to content

Commit

Permalink
Support shared drives - see fsspec#40
Browse files Browse the repository at this point in the history
  • Loading branch information
rhunwicks committed Mar 2, 2024
1 parent ab45b57 commit 6e25393
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions gdrivefs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def mkdir(self, path, create_parents=True, **kwargs):
meta = {"name": path.rstrip("/").rsplit("/", 1)[-1],
'mimeType': DIR_MIME_TYPE,
"parents": [parent_id]}
self.service.create(body=meta).execute()
self.service.create(body=meta, supportsAllDrives=True).execute()
self.invalidate_cache(self._parent(path))

def makedirs(self, path, exist_ok=True):
Expand All @@ -140,7 +140,7 @@ def makedirs(self, path, exist_ok=True):
self.mkdir(path, create_parents=False)

def _delete(self, file_id):
self.service.delete(fileId=file_id).execute()
self.service.delete(fileId=file_id, supportsAllDrives=True).execute()

def rm(self, path, recursive=True, maxdepth=None):
if recursive is False and self.isdir(path) and self.ls(path):
Expand All @@ -156,7 +156,7 @@ def rmdir(self, path):

def _info_by_id(self, file_id, path_prefix=None):
response = self.service.get(fileId=file_id, fields=fields,
).execute()
supportsAllDrives=True).execute()
return _finfo_from_response(response, path_prefix)

def export(self, path, mime_type):
Expand Down Expand Up @@ -200,7 +200,9 @@ def _list_directory_by_id(self, file_id, trashed=False, path_prefix=None):
while True:
response = self.service.list(q=query,
spaces=self.spaces, fields=afields,
pageToken=page_token).execute()
pageToken=page_token,
supportsAllDrives=True,
includeItemsFromAllDrives=True).execute()
for f in response.get('files', []):
all_files.append(_finfo_from_response(f, path_prefix))
more = response.get('incompleteSearch', False)
Expand Down

0 comments on commit 6e25393

Please sign in to comment.