Skip to content

Commit

Permalink
Merge pull request #6 from MaxRis/support-all-drives
Browse files Browse the repository at this point in the history
Update deprecated params to support Teamdrives
  • Loading branch information
shcheklein authored Jan 27, 2020
2 parents 330c4f9 + a4d5cc6 commit 3727f7a
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions pydrive2/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ def _GetList(self):
:returns: list -- list of pydrive2.files.GoogleDriveFile.
"""
# Teamdrive support
self['corpus'] = 'DEFAULT'
self['supportsTeamDrives'] = True
self['includeTeamDriveItems'] = True
self['supportsAllDrives'] = True
self['includeItemsFromAllDrives'] = True

try:
self.metadata = self.auth.service.files().list(**dict(self)).execute(
Expand Down Expand Up @@ -245,7 +244,7 @@ def FetchMetadata(self, fields=None, fetch_all=False):
fileId=file_id,
fields=fields,
# Teamdrive support
supportsTeamDrives=True
supportsAllDrives=True
).execute(http=self.http)
except errors.HttpError as error:
raise ApiRequestError(error)
Expand Down Expand Up @@ -376,7 +375,7 @@ def _FilesInsert(self, param=None):
param['body'] = self.GetChanges()

# teamdrive support
param['supportsTeamDrives'] = True
param['supportsAllDrives'] = True

try:
if self.dirty['content']:
Expand All @@ -402,7 +401,7 @@ def _FilesUnTrash(self, param=None):
param['fileId'] = self.metadata.get('id') or self['id']

# Teamdrive support
param['supportsTeamDrives'] = True
param['supportsAllDrives'] = True

try:
self.auth.service.files().untrash(**param).execute(
Expand All @@ -427,7 +426,7 @@ def _FilesTrash(self, param=None):
param['fileId'] = self.metadata.get('id') or self['id']

# Teamdrive support
param['supportsTeamDrives'] = True
param['supportsAllDrives'] = True

try:
self.auth.service.files().trash(**param).execute(
Expand All @@ -453,7 +452,7 @@ def _FilesDelete(self, param=None):
param['fileId'] = self.metadata.get('id') or self['id']

# Teamdrive support
param['supportsTeamDrives'] = True
param['supportsAllDrives'] = True

try:
self.auth.service.files().delete(**param).execute(http=self.http)
Expand All @@ -477,7 +476,7 @@ def _FilesUpdate(self, param=None):
param['fileId'] = self.metadata.get('id')

# Teamdrive support
param['supportsTeamDrives'] = True
param['supportsAllDrives'] = True

try:
if self.dirty['content']:
Expand Down Expand Up @@ -506,7 +505,7 @@ def _FilesPatch(self, param=None):
param['fileId'] = self.metadata.get('id')

# Teamdrive support
param['supportsTeamDrives'] = True
param['supportsAllDrives'] = True

try:
metadata = self.auth.service.files().patch(**param).execute(
Expand Down

0 comments on commit 3727f7a

Please sign in to comment.