From 749a13b0dbabc7f36d352908d51842f3e262ed91 Mon Sep 17 00:00:00 2001 From: nithinmurali Date: Sun, 15 Mar 2020 03:04:05 +0530 Subject: [PATCH] small fix in files list , added docs --- docs/source/authorization.rst | 7 +++++++ pygsheets/drive.py | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/source/authorization.rst b/docs/source/authorization.rst index b6a0632..dcc1b3a 100644 --- a/docs/source/authorization.rst +++ b/docs/source/authorization.rst @@ -135,3 +135,10 @@ You can create your own authentication method and pass them like this:: gc = pygsheets.authorize(custom_credentials=my_credentials) This option will ignore any other parameters. + +An example of creating credentials from secrect dict.:: + + SCOPES = ('https://www.googleapis.com/auth/spreadsheets', 'https://www.googleapis.com/auth/drive') + service_account_info = json.loads(secret_dict) + my_credentials = service_account.Credentials.from_service_account_info(service_account_info, scopes=SCOPES) + gc = pygsheets.authorize(custom_credentials=my_credentials) \ No newline at end of file diff --git a/pygsheets/drive.py b/pygsheets/drive.py index 0ad03fe..d1a04bd 100644 --- a/pygsheets/drive.py +++ b/pygsheets/drive.py @@ -113,18 +113,18 @@ def spreadsheet_metadata(self, query='', only_team_drive=False): supportsTeamDrives=True, includeTeamDriveItems=True, fields=FIELDS_TO_INCLUDE, - q=query) + q=query, pageSize=500, orderBy='recency') if not result and not only_team_drive: result = self.list(fields=FIELDS_TO_INCLUDE, supportsTeamDrives=True, includeTeamDriveItems=self.include_team_drive_items, - q=query) + q=query, pageSize=500, orderBy='recency') return result else: return self.list(fields=FIELDS_TO_INCLUDE, supportsTeamDrives=True, includeTeamDriveItems=self.include_team_drive_items, - q=query) + q=query, pageSize=500, orderBy='recency') def delete(self, file_id, **kwargs): """Delete a file by ID.