Skip to content

Commit

Permalink
Initial drive api update to v3 (Not tested)
Browse files Browse the repository at this point in the history
  • Loading branch information
joapuiib committed Feb 9, 2020
1 parent cf58f81 commit ab84389
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
13 changes: 4 additions & 9 deletions pydrive/apiattr.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,10 @@ def GetList(self):
:returns: list -- list of API resources.
"""
if self.get('maxResults') is None:
self['maxResults'] = 1000
result = []
for x in self:
result.extend(x)
del self['maxResults']
return result
else:
return next(self)
result = []
for x in self:
result.extend(x)
return result

def _GetList(self):
"""Helper function which actually makes API call.
Expand Down
2 changes: 1 addition & 1 deletion pydrive/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ def Authorize(self):
if self.access_token_expired:
raise AuthenticationError('No valid credentials provided to authorize')
self.http = self.credentials.authorize(self.http)
self.service = build('drive', 'v2', http=self.http, cache_discovery=False)
self.service = build('drive', 'v3', http=self.http, cache_discovery=False)

def Get_Http_Object(self):
"""Create and authorize an httplib2.Http object. Necessary for
Expand Down
8 changes: 4 additions & 4 deletions pydrive/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ def _GetList(self):
:returns: list -- list of pydrive.files.GoogleDriveFile.
"""
# Teamdrive support
self['corpus'] = 'DEFAULT'
self['supportsTeamDrives'] = True
self['includeTeamDriveItems'] = True
self['includeItemsFromAllDrives'] = True
self['supportsAllDrives'] = True

self.metadata = self.auth.service.files().list(**dict(self)).execute(
http=self.http)


result = []
for file_metadata in self.metadata['items']:
for file_metadata in self.metadata['files']:
tmp_file = GoogleDriveFile(
auth=self.auth,
metadata=file_metadata,
Expand Down

0 comments on commit ab84389

Please sign in to comment.