diff --git a/gspread/exceptions.py b/gspread/exceptions.py index 1a632274f..4701ebdf7 100644 --- a/gspread/exceptions.py +++ b/gspread/exceptions.py @@ -6,7 +6,7 @@ """ -from typing import Dict, Optional, Union +from typing import Any, Dict, Mapping, Optional, Union from requests import Response @@ -40,15 +40,12 @@ class APIError(GSpreadException): such as when we attempt to retrieve things that don't exist.""" def __init__(self, response: Response): - super().__init__(self._extract_text(response)) + super().__init__(self._extract_error(response)) self.response: Response = response + self.error: Mapping[str, Any] = response.json()["error"] + self.code: int = self.error["code"] - def _extract_text( - self, response: Response - ) -> Union[Dict[str, Union[int, str]], str]: - return self._text_from_detail(response) or response.text - - def _text_from_detail( + def _extract_error( self, response: Response ) -> Optional[Dict[str, Union[int, str]]]: try: @@ -57,6 +54,14 @@ def _text_from_detail( except (AttributeError, KeyError, ValueError): return None + def __str__(self) -> str: + return "{}: [{}]: {}".format( + self.__class__.__name__, self.code, self.error["message"] + ) + + def __repr__(self) -> str: + return self.__str__() + class SpreadsheetNotFound(GSpreadException): """Trying to open non-existent or inaccessible spreadsheet.""" diff --git a/gspread/http_client.py b/gspread/http_client.py index 1c99aa582..7f5b2f6e0 100644 --- a/gspread/http_client.py +++ b/gspread/http_client.py @@ -6,6 +6,7 @@ Google API. """ +import time from http import HTTPStatus from typing import ( IO, @@ -493,31 +494,50 @@ class BackOffHTTPClient(HTTPClient): for api rate limit exceeded.""" _HTTP_ERROR_CODES: List[HTTPStatus] = [ - HTTPStatus.FORBIDDEN, # Drive API return a 403 Forbidden on usage rate limit exceeded HTTPStatus.REQUEST_TIMEOUT, # in case of a timeout HTTPStatus.TOO_MANY_REQUESTS, # sheet API usage rate limit exceeded ] _NR_BACKOFF: int = 0 _MAX_BACKOFF: int = 128 # arbitrary maximum backoff - _MAX_BACKOFF_REACHED: bool = False # Stop after reaching _MAX_BACKOFF def request(self, *args: Any, **kwargs: Any) -> Response: + # Check if we should retry the request + def _should_retry( + code: int, + error: Mapping[str, Any], + wait: int, + ) -> bool: + # Drive API return a dict object 'errors', the sheet API does not + if "errors" in error: + # Drive API returns a code 403 when reaching quotas/usage limits + if ( + code == HTTPStatus.FORBIDDEN + and error["errors"][0]["domain"] == "usageLimits" + ): + return True + + # We retry if: + # - the return code is one of: + # - 429: too many requests + # - 408: request timeout + # - >= 500: some server error + # - AND we did not reach the max retry limit + return ( + code in self._HTTP_ERROR_CODES + or code >= HTTPStatus.INTERNAL_SERVER_ERROR + ) and wait <= self._MAX_BACKOFF + try: return super().request(*args, **kwargs) except APIError as err: - data = err.response.json() - code = data["error"]["code"] - - # check if error should retry - if code in self._HTTP_ERROR_CODES and self._MAX_BACKOFF_REACHED is False: - self._NR_BACKOFF += 1 - wait = min(2**self._NR_BACKOFF, self._MAX_BACKOFF) + code = err.code + error = err.error - if wait >= self._MAX_BACKOFF: - self._MAX_BACKOFF_REACHED = True - - import time + self._NR_BACKOFF += 1 + wait = min(2**self._NR_BACKOFF, self._MAX_BACKOFF) + # check if error should retry + if _should_retry(code, error, wait) is True: time.sleep(wait) # make the request again @@ -525,7 +545,6 @@ def request(self, *args: Any, **kwargs: Any) -> Response: # reset counters for next time self._NR_BACKOFF = 0 - self._MAX_BACKOFF_REACHED = False return response diff --git a/tests/cassettes/ClientTest.test_access_private_spreadsheet.json b/tests/cassettes/ClientTest.test_access_private_spreadsheet.json index 3cbf30184..3ecb307ed 100644 --- a/tests/cassettes/ClientTest.test_access_private_spreadsheet.json +++ b/tests/cassettes/ClientTest.test_access_private_spreadsheet.json @@ -36,26 +36,23 @@ "message": "OK" }, "headers": { - "Expires": [ - "Mon, 01 Jan 1990 00:00:00 GMT" - ], - "Server": [ - "ESF" - ], - "Cache-Control": [ - "no-cache, no-store, max-age=0, must-revalidate" + "Date": [ + "Sat, 17 Feb 2024 11:03:59 GMT" ], - "Transfer-Encoding": [ - "chunked" + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" ], - "X-Frame-Options": [ - "SAMEORIGIN" + "Vary": [ + "Origin, X-Origin" ], "Pragma": [ "no-cache" ], - "Alt-Svc": [ - "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" ], "X-Content-Type-Options": [ "nosniff" @@ -63,28 +60,28 @@ "Content-Type": [ "application/json; charset=UTF-8" ], - "X-XSS-Protection": [ - "0" + "Server": [ + "ESF" ], - "Date": [ - "Thu, 17 Aug 2023 10:52:45 GMT" + "X-Frame-Options": [ + "SAMEORIGIN" ], - "Vary": [ - "Origin, X-Origin" + "X-XSS-Protection": [ + "0" ], "content-length": [ "201" ] }, "body": { - "string": "{\n \"kind\": \"drive#file\",\n \"id\": \"1ny3My0ypwRIMsqgD6f8INUBMOX_cOtm47DnT9IjgQ1o\",\n \"name\": \"Test ClientTest test_access_private_spreadsheet\",\n \"mimeType\": \"application/vnd.google-apps.spreadsheet\"\n}\n" + "string": "{\n \"kind\": \"drive#file\",\n \"id\": \"1_EaBz4exHK3x5wohaCDnv6QIUZps-Msk2g3-l471HQw\",\n \"name\": \"Test ClientTest test_access_private_spreadsheet\",\n \"mimeType\": \"application/vnd.google-apps.spreadsheet\"\n}\n" } } }, { "request": { "method": "GET", - "uri": "https://sheets.googleapis.com/v4/spreadsheets/1ny3My0ypwRIMsqgD6f8INUBMOX_cOtm47DnT9IjgQ1o?includeGridData=false", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1_EaBz4exHK3x5wohaCDnv6QIUZps-Msk2g3-l471HQw?includeGridData=false", "body": null, "headers": { "User-Agent": [ @@ -110,128 +107,51 @@ "message": "OK" }, "headers": { - "Server": [ - "ESF" - ], - "Cache-Control": [ - "private" - ], - "Transfer-Encoding": [ - "chunked" - ], - "X-Frame-Options": [ - "SAMEORIGIN" - ], - "x-l2-request-path": [ - "l2-managed-6" + "Date": [ + "Sat, 17 Feb 2024 11:04:00 GMT" ], "Alt-Svc": [ "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" ], - "X-Content-Type-Options": [ - "nosniff" - ], - "Content-Type": [ - "application/json; charset=UTF-8" - ], - "X-XSS-Protection": [ - "0" - ], - "Date": [ - "Thu, 17 Aug 2023 10:52:46 GMT" - ], "Vary": [ "Origin", "X-Origin", "Referer" ], - "content-length": [ - "3345" - ] - }, - "body": { - "string": "{\n \"spreadsheetId\": \"1ny3My0ypwRIMsqgD6f8INUBMOX_cOtm47DnT9IjgQ1o\",\n \"properties\": {\n \"title\": \"Test ClientTest test_access_private_spreadsheet\",\n \"locale\": \"en_US\",\n \"autoRecalc\": \"ON_CHANGE\",\n \"timeZone\": \"Etc/GMT\",\n \"defaultFormat\": {\n \"backgroundColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"padding\": {\n \"top\": 2,\n \"right\": 3,\n \"bottom\": 2,\n \"left\": 3\n },\n \"verticalAlignment\": \"BOTTOM\",\n \"wrapStrategy\": \"OVERFLOW_CELL\",\n \"textFormat\": {\n \"foregroundColor\": {},\n \"fontFamily\": \"arial,sans,sans-serif\",\n \"fontSize\": 10,\n \"bold\": false,\n \"italic\": false,\n \"strikethrough\": false,\n \"underline\": false,\n \"foregroundColorStyle\": {\n \"rgbColor\": {}\n }\n },\n \"backgroundColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n \"spreadsheetTheme\": {\n \"primaryFontFamily\": \"Arial\",\n \"themeColors\": [\n {\n \"colorType\": \"TEXT\",\n \"color\": {\n \"rgbColor\": {}\n }\n },\n {\n \"colorType\": \"BACKGROUND\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n {\n \"colorType\": \"ACCENT1\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.25882354,\n \"green\": 0.52156866,\n \"blue\": 0.95686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT2\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.91764706,\n \"green\": 0.2627451,\n \"blue\": 0.20784314\n }\n }\n },\n {\n \"colorType\": \"ACCENT3\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.9843137,\n \"green\": 0.7372549,\n \"blue\": 0.015686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT4\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.20392157,\n \"green\": 0.65882355,\n \"blue\": 0.3254902\n }\n }\n },\n {\n \"colorType\": \"ACCENT5\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 0.42745098,\n \"blue\": 0.003921569\n }\n }\n },\n {\n \"colorType\": \"ACCENT6\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.27450982,\n \"green\": 0.7411765,\n \"blue\": 0.7764706\n }\n }\n },\n {\n \"colorType\": \"LINK\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.06666667,\n \"green\": 0.33333334,\n \"blue\": 0.8\n }\n }\n }\n ]\n }\n },\n \"sheets\": [\n {\n \"properties\": {\n \"sheetId\": 0,\n \"title\": \"Sheet1\",\n \"index\": 0,\n \"sheetType\": \"GRID\",\n \"gridProperties\": {\n \"rowCount\": 1000,\n \"columnCount\": 26\n }\n }\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1ny3My0ypwRIMsqgD6f8INUBMOX_cOtm47DnT9IjgQ1o/edit\"\n}\n" - } - } - }, - { - "request": { - "method": "GET", - "uri": "https://www.googleapis.com/drive/v3/files/1ny3My0ypwRIMsqgD6f8INUBMOX_cOtm47DnT9IjgQ1o?supportsAllDrives=True&includeItemsFromAllDrives=True&fields=id%2Cname%2CcreatedTime%2CmodifiedTime", - "body": null, - "headers": { - "User-Agent": [ - "python-requests/2.31.0" - ], - "Accept-Encoding": [ - "gzip, deflate" + "Cache-Control": [ + "private" ], - "Accept": [ - "*/*" + "X-Content-Type-Options": [ + "nosniff" ], - "Connection": [ - "keep-alive" + "x-l2-request-path": [ + "l2-managed-6" ], - "authorization": [ - "" - ] - } - }, - "response": { - "status": { - "code": 200, - "message": "OK" - }, - "headers": { - "Expires": [ - "Mon, 01 Jan 1990 00:00:00 GMT" + "Content-Type": [ + "application/json; charset=UTF-8" ], "Server": [ "ESF" ], - "Cache-Control": [ - "no-cache, no-store, max-age=0, must-revalidate" - ], - "Transfer-Encoding": [ - "chunked" - ], "X-Frame-Options": [ "SAMEORIGIN" ], - "Pragma": [ - "no-cache" - ], - "Alt-Svc": [ - "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" - ], - "X-Content-Type-Options": [ - "nosniff" - ], - "Content-Type": [ - "application/json; charset=UTF-8" - ], "X-XSS-Protection": [ "0" ], - "Date": [ - "Thu, 17 Aug 2023 10:52:46 GMT" - ], - "Vary": [ - "Origin, X-Origin" - ], "content-length": [ - "211" + "3345" ] }, "body": { - "string": "{\n \"id\": \"1ny3My0ypwRIMsqgD6f8INUBMOX_cOtm47DnT9IjgQ1o\",\n \"name\": \"Test ClientTest test_access_private_spreadsheet\",\n \"createdTime\": \"2023-08-17T10:52:42.941Z\",\n \"modifiedTime\": \"2023-08-17T10:52:42.972Z\"\n}\n" + "string": "{\n \"spreadsheetId\": \"1_EaBz4exHK3x5wohaCDnv6QIUZps-Msk2g3-l471HQw\",\n \"properties\": {\n \"title\": \"Test ClientTest test_access_private_spreadsheet\",\n \"locale\": \"en_US\",\n \"autoRecalc\": \"ON_CHANGE\",\n \"timeZone\": \"Etc/GMT\",\n \"defaultFormat\": {\n \"backgroundColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"padding\": {\n \"top\": 2,\n \"right\": 3,\n \"bottom\": 2,\n \"left\": 3\n },\n \"verticalAlignment\": \"BOTTOM\",\n \"wrapStrategy\": \"OVERFLOW_CELL\",\n \"textFormat\": {\n \"foregroundColor\": {},\n \"fontFamily\": \"arial,sans,sans-serif\",\n \"fontSize\": 10,\n \"bold\": false,\n \"italic\": false,\n \"strikethrough\": false,\n \"underline\": false,\n \"foregroundColorStyle\": {\n \"rgbColor\": {}\n }\n },\n \"backgroundColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n \"spreadsheetTheme\": {\n \"primaryFontFamily\": \"Arial\",\n \"themeColors\": [\n {\n \"colorType\": \"TEXT\",\n \"color\": {\n \"rgbColor\": {}\n }\n },\n {\n \"colorType\": \"BACKGROUND\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n {\n \"colorType\": \"ACCENT1\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.25882354,\n \"green\": 0.52156866,\n \"blue\": 0.95686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT2\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.91764706,\n \"green\": 0.2627451,\n \"blue\": 0.20784314\n }\n }\n },\n {\n \"colorType\": \"ACCENT3\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.9843137,\n \"green\": 0.7372549,\n \"blue\": 0.015686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT4\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.20392157,\n \"green\": 0.65882355,\n \"blue\": 0.3254902\n }\n }\n },\n {\n \"colorType\": \"ACCENT5\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 0.42745098,\n \"blue\": 0.003921569\n }\n }\n },\n {\n \"colorType\": \"ACCENT6\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.27450982,\n \"green\": 0.7411765,\n \"blue\": 0.7764706\n }\n }\n },\n {\n \"colorType\": \"LINK\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.06666667,\n \"green\": 0.33333334,\n \"blue\": 0.8\n }\n }\n }\n ]\n }\n },\n \"sheets\": [\n {\n \"properties\": {\n \"sheetId\": 0,\n \"title\": \"Sheet1\",\n \"index\": 0,\n \"sheetType\": \"GRID\",\n \"gridProperties\": {\n \"rowCount\": 1000,\n \"columnCount\": 26\n }\n }\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1_EaBz4exHK3x5wohaCDnv6QIUZps-Msk2g3-l471HQw/edit\"\n}\n" } } }, { "request": { "method": "DELETE", - "uri": "https://www.googleapis.com/drive/v3/files/1ny3My0ypwRIMsqgD6f8INUBMOX_cOtm47DnT9IjgQ1o?supportsAllDrives=True", + "uri": "https://www.googleapis.com/drive/v3/files/1_EaBz4exHK3x5wohaCDnv6QIUZps-Msk2g3-l471HQw?supportsAllDrives=True", "body": null, "headers": { "User-Agent": [ @@ -260,132 +180,52 @@ "message": "No Content" }, "headers": { - "Expires": [ - "Mon, 01 Jan 1990 00:00:00 GMT" - ], - "Server": [ - "ESF" - ], - "Cache-Control": [ - "no-cache, no-store, max-age=0, must-revalidate" - ], - "X-Frame-Options": [ - "SAMEORIGIN" - ], - "Content-Length": [ - "0" - ], - "Pragma": [ - "no-cache" + "Date": [ + "Sat, 17 Feb 2024 11:04:01 GMT" ], "Alt-Svc": [ "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" ], - "X-Content-Type-Options": [ - "nosniff" - ], - "Content-Type": [ - "text/html" - ], - "X-XSS-Protection": [ - "0" - ], - "Date": [ - "Thu, 17 Aug 2023 10:52:47 GMT" - ], "Vary": [ "Origin, X-Origin" - ] - }, - "body": { - "string": "" - } - } - }, - { - "request": { - "method": "POST", - "uri": "https://www.googleapis.com/drive/v3/files?supportsAllDrives=True", - "body": "{\"name\": \"Test ClientTest test_access_private_spreadsheet\", \"mimeType\": \"application/vnd.google-apps.spreadsheet\"}", - "headers": { - "User-Agent": [ - "python-requests/2.31.0" - ], - "Accept-Encoding": [ - "gzip, deflate" - ], - "Accept": [ - "*/*" - ], - "Connection": [ - "keep-alive" - ], - "Content-Length": [ - "114" ], - "Content-Type": [ - "application/json" - ], - "authorization": [ - "" - ] - } - }, - "response": { - "status": { - "code": 200, - "message": "OK" - }, - "headers": { "Pragma": [ "no-cache" ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], "Cache-Control": [ "no-cache, no-store, max-age=0, must-revalidate" ], - "Alt-Svc": [ - "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + "X-Content-Type-Options": [ + "nosniff" ], - "Expires": [ - "Mon, 01 Jan 1990 00:00:00 GMT" + "Content-Type": [ + "text/html" ], "Server": [ "ESF" ], - "Transfer-Encoding": [ - "chunked" - ], - "X-Content-Type-Options": [ - "nosniff" - ], - "Date": [ - "Thu, 17 Aug 2023 10:54:38 GMT" + "Content-Length": [ + "0" ], "X-Frame-Options": [ "SAMEORIGIN" ], - "Vary": [ - "Origin, X-Origin" - ], - "Content-Type": [ - "application/json; charset=UTF-8" - ], "X-XSS-Protection": [ "0" - ], - "content-length": [ - "201" ] }, "body": { - "string": "{\n \"kind\": \"drive#file\",\n \"id\": \"1YT5mpwU6Vs-aTHGKzVo2YtMAka8n6KlBrO6cfkNjbdI\",\n \"name\": \"Test ClientTest test_access_private_spreadsheet\",\n \"mimeType\": \"application/vnd.google-apps.spreadsheet\"\n}\n" + "string": "" } } }, { "request": { "method": "GET", - "uri": "https://sheets.googleapis.com/v4/spreadsheets/1YT5mpwU6Vs-aTHGKzVo2YtMAka8n6KlBrO6cfkNjbdI?includeGridData=false", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1jIKzPs8LsiZZdLdeMEP-5ZIHw6RkjiOmj1LrJN706Yc?includeGridData=false", "body": null, "headers": { "User-Agent": [ @@ -407,727 +247,51 @@ }, "response": { "status": { - "code": 200, - "message": "OK" + "code": 403, + "message": "Forbidden" }, "headers": { - "x-l2-request-path": [ - "l2-managed-6" + "Vary": [ + "Origin", + "X-Origin", + "Referer" ], - "Cache-Control": [ - "private" + "X-XSS-Protection": [ + "0" + ], + "Date": [ + "Sat, 17 Feb 2024 11:06:25 GMT" + ], + "X-Frame-Options": [ + "SAMEORIGIN" ], "Alt-Svc": [ "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" ], - "Server": [ - "ESF" - ], "Transfer-Encoding": [ "chunked" ], "X-Content-Type-Options": [ "nosniff" ], - "Date": [ - "Thu, 17 Aug 2023 10:54:39 GMT" + "Server": [ + "ESF" ], - "X-Frame-Options": [ - "SAMEORIGIN" - ], - "Vary": [ - "Origin", - "X-Origin", - "Referer" - ], - "Content-Type": [ - "application/json; charset=UTF-8" - ], - "X-XSS-Protection": [ - "0" - ], - "content-length": [ - "3345" - ] - }, - "body": { - "string": "{\n \"spreadsheetId\": \"1YT5mpwU6Vs-aTHGKzVo2YtMAka8n6KlBrO6cfkNjbdI\",\n \"properties\": {\n \"title\": \"Test ClientTest test_access_private_spreadsheet\",\n \"locale\": \"en_US\",\n \"autoRecalc\": \"ON_CHANGE\",\n \"timeZone\": \"Etc/GMT\",\n \"defaultFormat\": {\n \"backgroundColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"padding\": {\n \"top\": 2,\n \"right\": 3,\n \"bottom\": 2,\n \"left\": 3\n },\n \"verticalAlignment\": \"BOTTOM\",\n \"wrapStrategy\": \"OVERFLOW_CELL\",\n \"textFormat\": {\n \"foregroundColor\": {},\n \"fontFamily\": \"arial,sans,sans-serif\",\n \"fontSize\": 10,\n \"bold\": false,\n \"italic\": false,\n \"strikethrough\": false,\n \"underline\": false,\n \"foregroundColorStyle\": {\n \"rgbColor\": {}\n }\n },\n \"backgroundColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n \"spreadsheetTheme\": {\n \"primaryFontFamily\": \"Arial\",\n \"themeColors\": [\n {\n \"colorType\": \"TEXT\",\n \"color\": {\n \"rgbColor\": {}\n }\n },\n {\n \"colorType\": \"BACKGROUND\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n {\n \"colorType\": \"ACCENT1\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.25882354,\n \"green\": 0.52156866,\n \"blue\": 0.95686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT2\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.91764706,\n \"green\": 0.2627451,\n \"blue\": 0.20784314\n }\n }\n },\n {\n \"colorType\": \"ACCENT3\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.9843137,\n \"green\": 0.7372549,\n \"blue\": 0.015686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT4\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.20392157,\n \"green\": 0.65882355,\n \"blue\": 0.3254902\n }\n }\n },\n {\n \"colorType\": \"ACCENT5\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 0.42745098,\n \"blue\": 0.003921569\n }\n }\n },\n {\n \"colorType\": \"ACCENT6\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.27450982,\n \"green\": 0.7411765,\n \"blue\": 0.7764706\n }\n }\n },\n {\n \"colorType\": \"LINK\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.06666667,\n \"green\": 0.33333334,\n \"blue\": 0.8\n }\n }\n }\n ]\n }\n },\n \"sheets\": [\n {\n \"properties\": {\n \"sheetId\": 0,\n \"title\": \"Sheet1\",\n \"index\": 0,\n \"sheetType\": \"GRID\",\n \"gridProperties\": {\n \"rowCount\": 1000,\n \"columnCount\": 26\n }\n }\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1YT5mpwU6Vs-aTHGKzVo2YtMAka8n6KlBrO6cfkNjbdI/edit\"\n}\n" - } - } - }, - { - "request": { - "method": "GET", - "uri": "https://www.googleapis.com/drive/v3/files/1YT5mpwU6Vs-aTHGKzVo2YtMAka8n6KlBrO6cfkNjbdI?supportsAllDrives=True&includeItemsFromAllDrives=True&fields=id%2Cname%2CcreatedTime%2CmodifiedTime", - "body": null, - "headers": { - "User-Agent": [ - "python-requests/2.31.0" - ], - "Accept-Encoding": [ - "gzip, deflate" - ], - "Accept": [ - "*/*" - ], - "Connection": [ - "keep-alive" - ], - "authorization": [ - "" - ] - } - }, - "response": { - "status": { - "code": 200, - "message": "OK" - }, - "headers": { - "Pragma": [ - "no-cache" - ], - "Cache-Control": [ - "no-cache, no-store, max-age=0, must-revalidate" - ], - "Alt-Svc": [ - "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" - ], - "Expires": [ - "Mon, 01 Jan 1990 00:00:00 GMT" - ], - "Server": [ - "ESF" - ], - "Transfer-Encoding": [ - "chunked" - ], - "X-Content-Type-Options": [ - "nosniff" - ], - "Date": [ - "Thu, 17 Aug 2023 10:54:39 GMT" - ], - "X-Frame-Options": [ - "SAMEORIGIN" - ], - "Vary": [ - "Origin, X-Origin" - ], - "Content-Type": [ - "application/json; charset=UTF-8" - ], - "X-XSS-Protection": [ - "0" - ], - "content-length": [ - "211" - ] - }, - "body": { - "string": "{\n \"id\": \"1YT5mpwU6Vs-aTHGKzVo2YtMAka8n6KlBrO6cfkNjbdI\",\n \"name\": \"Test ClientTest test_access_private_spreadsheet\",\n \"createdTime\": \"2023-08-17T10:54:35.939Z\",\n \"modifiedTime\": \"2023-08-17T10:54:35.958Z\"\n}\n" - } - } - }, - { - "request": { - "method": "DELETE", - "uri": "https://www.googleapis.com/drive/v3/files/1YT5mpwU6Vs-aTHGKzVo2YtMAka8n6KlBrO6cfkNjbdI?supportsAllDrives=True", - "body": null, - "headers": { - "User-Agent": [ - "python-requests/2.31.0" - ], - "Accept-Encoding": [ - "gzip, deflate" - ], - "Accept": [ - "*/*" - ], - "Connection": [ - "keep-alive" - ], - "Content-Length": [ - "0" - ], - "authorization": [ - "" - ] - } - }, - "response": { - "status": { - "code": 204, - "message": "No Content" - }, - "headers": { - "Pragma": [ - "no-cache" - ], - "Cache-Control": [ - "no-cache, no-store, max-age=0, must-revalidate" - ], - "Alt-Svc": [ - "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" - ], - "Expires": [ - "Mon, 01 Jan 1990 00:00:00 GMT" - ], - "Server": [ - "ESF" - ], - "Content-Length": [ - "0" - ], - "X-Content-Type-Options": [ - "nosniff" - ], - "Date": [ - "Thu, 17 Aug 2023 10:54:40 GMT" - ], - "X-Frame-Options": [ - "SAMEORIGIN" - ], - "Vary": [ - "Origin, X-Origin" - ], - "Content-Type": [ - "text/html" - ], - "X-XSS-Protection": [ - "0" - ] - }, - "body": { - "string": "" - } - } - }, - { - "request": { - "method": "POST", - "uri": "https://www.googleapis.com/drive/v3/files?supportsAllDrives=True", - "body": "{\"name\": \"Test ClientTest test_access_private_spreadsheet\", \"mimeType\": \"application/vnd.google-apps.spreadsheet\"}", - "headers": { - "User-Agent": [ - "python-requests/2.31.0" - ], - "Accept-Encoding": [ - "gzip, deflate" - ], - "Accept": [ - "*/*" - ], - "Connection": [ - "keep-alive" - ], - "Content-Length": [ - "114" - ], - "Content-Type": [ - "application/json" - ], - "authorization": [ - "" - ] - } - }, - "response": { - "status": { - "code": 200, - "message": "OK" - }, - "headers": { - "X-Frame-Options": [ - "SAMEORIGIN" - ], - "Date": [ - "Thu, 17 Aug 2023 10:54:47 GMT" - ], - "Pragma": [ - "no-cache" - ], - "Alt-Svc": [ - "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" - ], - "X-XSS-Protection": [ - "0" - ], - "Server": [ - "ESF" - ], - "Expires": [ - "Mon, 01 Jan 1990 00:00:00 GMT" - ], - "Transfer-Encoding": [ - "chunked" - ], - "Content-Type": [ - "application/json; charset=UTF-8" - ], - "X-Content-Type-Options": [ - "nosniff" - ], - "Cache-Control": [ - "no-cache, no-store, max-age=0, must-revalidate" - ], - "Vary": [ - "Origin, X-Origin" - ], - "content-length": [ - "201" - ] - }, - "body": { - "string": "{\n \"kind\": \"drive#file\",\n \"id\": \"1hqH1HFP-NpmxK-0P80dyr6u8oI5ck-Su2oqN0z11WS4\",\n \"name\": \"Test ClientTest test_access_private_spreadsheet\",\n \"mimeType\": \"application/vnd.google-apps.spreadsheet\"\n}\n" - } - } - }, - { - "request": { - "method": "GET", - "uri": "https://sheets.googleapis.com/v4/spreadsheets/1hqH1HFP-NpmxK-0P80dyr6u8oI5ck-Su2oqN0z11WS4?includeGridData=false", - "body": null, - "headers": { - "User-Agent": [ - "python-requests/2.31.0" - ], - "Accept-Encoding": [ - "gzip, deflate" - ], - "Accept": [ - "*/*" - ], - "Connection": [ - "keep-alive" - ], - "authorization": [ - "" - ] - } - }, - "response": { - "status": { - "code": 200, - "message": "OK" - }, - "headers": { - "X-Frame-Options": [ - "SAMEORIGIN" - ], - "Date": [ - "Thu, 17 Aug 2023 10:54:47 GMT" - ], - "Alt-Svc": [ - "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" - ], - "X-XSS-Protection": [ - "0" - ], - "Server": [ - "ESF" - ], - "Transfer-Encoding": [ - "chunked" - ], - "Content-Type": [ - "application/json; charset=UTF-8" - ], - "X-Content-Type-Options": [ - "nosniff" - ], - "x-l2-request-path": [ - "l2-managed-6" - ], - "Cache-Control": [ - "private" - ], - "Vary": [ - "Origin", - "X-Origin", - "Referer" - ], - "content-length": [ - "3345" - ] - }, - "body": { - "string": "{\n \"spreadsheetId\": \"1hqH1HFP-NpmxK-0P80dyr6u8oI5ck-Su2oqN0z11WS4\",\n \"properties\": {\n \"title\": \"Test ClientTest test_access_private_spreadsheet\",\n \"locale\": \"en_US\",\n \"autoRecalc\": \"ON_CHANGE\",\n \"timeZone\": \"Etc/GMT\",\n \"defaultFormat\": {\n \"backgroundColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"padding\": {\n \"top\": 2,\n \"right\": 3,\n \"bottom\": 2,\n \"left\": 3\n },\n \"verticalAlignment\": \"BOTTOM\",\n \"wrapStrategy\": \"OVERFLOW_CELL\",\n \"textFormat\": {\n \"foregroundColor\": {},\n \"fontFamily\": \"arial,sans,sans-serif\",\n \"fontSize\": 10,\n \"bold\": false,\n \"italic\": false,\n \"strikethrough\": false,\n \"underline\": false,\n \"foregroundColorStyle\": {\n \"rgbColor\": {}\n }\n },\n \"backgroundColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n \"spreadsheetTheme\": {\n \"primaryFontFamily\": \"Arial\",\n \"themeColors\": [\n {\n \"colorType\": \"TEXT\",\n \"color\": {\n \"rgbColor\": {}\n }\n },\n {\n \"colorType\": \"BACKGROUND\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n {\n \"colorType\": \"ACCENT1\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.25882354,\n \"green\": 0.52156866,\n \"blue\": 0.95686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT2\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.91764706,\n \"green\": 0.2627451,\n \"blue\": 0.20784314\n }\n }\n },\n {\n \"colorType\": \"ACCENT3\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.9843137,\n \"green\": 0.7372549,\n \"blue\": 0.015686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT4\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.20392157,\n \"green\": 0.65882355,\n \"blue\": 0.3254902\n }\n }\n },\n {\n \"colorType\": \"ACCENT5\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 0.42745098,\n \"blue\": 0.003921569\n }\n }\n },\n {\n \"colorType\": \"ACCENT6\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.27450982,\n \"green\": 0.7411765,\n \"blue\": 0.7764706\n }\n }\n },\n {\n \"colorType\": \"LINK\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.06666667,\n \"green\": 0.33333334,\n \"blue\": 0.8\n }\n }\n }\n ]\n }\n },\n \"sheets\": [\n {\n \"properties\": {\n \"sheetId\": 0,\n \"title\": \"Sheet1\",\n \"index\": 0,\n \"sheetType\": \"GRID\",\n \"gridProperties\": {\n \"rowCount\": 1000,\n \"columnCount\": 26\n }\n }\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1hqH1HFP-NpmxK-0P80dyr6u8oI5ck-Su2oqN0z11WS4/edit\"\n}\n" - } - } - }, - { - "request": { - "method": "GET", - "uri": "https://www.googleapis.com/drive/v3/files/1hqH1HFP-NpmxK-0P80dyr6u8oI5ck-Su2oqN0z11WS4?supportsAllDrives=True&includeItemsFromAllDrives=True&fields=id%2Cname%2CcreatedTime%2CmodifiedTime", - "body": null, - "headers": { - "User-Agent": [ - "python-requests/2.31.0" - ], - "Accept-Encoding": [ - "gzip, deflate" - ], - "Accept": [ - "*/*" - ], - "Connection": [ - "keep-alive" - ], - "authorization": [ - "" - ] - } - }, - "response": { - "status": { - "code": 200, - "message": "OK" - }, - "headers": { - "X-Frame-Options": [ - "SAMEORIGIN" - ], - "Date": [ - "Thu, 17 Aug 2023 10:54:47 GMT" - ], - "Pragma": [ - "no-cache" - ], - "Alt-Svc": [ - "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" - ], - "X-XSS-Protection": [ - "0" - ], - "Server": [ - "ESF" - ], - "Expires": [ - "Mon, 01 Jan 1990 00:00:00 GMT" - ], - "Transfer-Encoding": [ - "chunked" - ], - "Content-Type": [ - "application/json; charset=UTF-8" - ], - "X-Content-Type-Options": [ - "nosniff" - ], - "Cache-Control": [ - "no-cache, no-store, max-age=0, must-revalidate" - ], - "Vary": [ - "Origin, X-Origin" - ], - "content-length": [ - "211" - ] - }, - "body": { - "string": "{\n \"id\": \"1hqH1HFP-NpmxK-0P80dyr6u8oI5ck-Su2oqN0z11WS4\",\n \"name\": \"Test ClientTest test_access_private_spreadsheet\",\n \"createdTime\": \"2023-08-17T10:54:44.806Z\",\n \"modifiedTime\": \"2023-08-17T10:54:44.822Z\"\n}\n" - } - } - }, - { - "request": { - "method": "DELETE", - "uri": "https://www.googleapis.com/drive/v3/files/1hqH1HFP-NpmxK-0P80dyr6u8oI5ck-Su2oqN0z11WS4?supportsAllDrives=True", - "body": null, - "headers": { - "User-Agent": [ - "python-requests/2.31.0" - ], - "Accept-Encoding": [ - "gzip, deflate" - ], - "Accept": [ - "*/*" - ], - "Connection": [ - "keep-alive" - ], - "Content-Length": [ - "0" - ], - "authorization": [ - "" - ] - } - }, - "response": { - "status": { - "code": 204, - "message": "No Content" - }, - "headers": { - "X-Frame-Options": [ - "SAMEORIGIN" - ], - "Date": [ - "Thu, 17 Aug 2023 10:55:12 GMT" - ], - "Pragma": [ - "no-cache" - ], - "Alt-Svc": [ - "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" - ], - "X-XSS-Protection": [ - "0" - ], - "Server": [ - "ESF" - ], - "Content-Length": [ - "0" - ], - "Expires": [ - "Mon, 01 Jan 1990 00:00:00 GMT" - ], - "Content-Type": [ - "text/html" - ], - "X-Content-Type-Options": [ - "nosniff" - ], - "Cache-Control": [ - "no-cache, no-store, max-age=0, must-revalidate" - ], - "Vary": [ - "Origin, X-Origin" - ] - }, - "body": { - "string": "" - } - } - }, - { - "request": { - "method": "POST", - "uri": "https://www.googleapis.com/drive/v3/files?supportsAllDrives=True", - "body": "{\"name\": \"Test ClientTest test_access_private_spreadsheet\", \"mimeType\": \"application/vnd.google-apps.spreadsheet\"}", - "headers": { - "User-Agent": [ - "python-requests/2.31.0" - ], - "Accept-Encoding": [ - "gzip, deflate" - ], - "Accept": [ - "*/*" - ], - "Connection": [ - "keep-alive" - ], - "Content-Length": [ - "114" - ], - "Content-Type": [ - "application/json" - ], - "authorization": [ - "" - ] - } - }, - "response": { - "status": { - "code": 200, - "message": "OK" - }, - "headers": { - "X-XSS-Protection": [ - "0" - ], - "X-Frame-Options": [ - "SAMEORIGIN" - ], - "X-Content-Type-Options": [ - "nosniff" - ], - "Content-Type": [ - "application/json; charset=UTF-8" + "Content-Type": [ + "application/json; charset=UTF-8" ], "Cache-Control": [ - "no-cache, no-store, max-age=0, must-revalidate" - ], - "Transfer-Encoding": [ - "chunked" - ], - "Alt-Svc": [ - "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" - ], - "Pragma": [ - "no-cache" - ], - "Date": [ - "Wed, 06 Sep 2023 21:14:07 GMT" - ], - "Expires": [ - "Mon, 01 Jan 1990 00:00:00 GMT" - ], - "Server": [ - "ESF" - ], - "Vary": [ - "Origin, X-Origin" - ], - "content-length": [ - "201" - ] - }, - "body": { - "string": "{\n \"kind\": \"drive#file\",\n \"id\": \"1kUnWJCY0UNgHG_HW9YchltSx7rs66cfAw79VJLl3G38\",\n \"name\": \"Test ClientTest test_access_private_spreadsheet\",\n \"mimeType\": \"application/vnd.google-apps.spreadsheet\"\n}\n" - } - } - }, - { - "request": { - "method": "GET", - "uri": "https://sheets.googleapis.com/v4/spreadsheets/1kUnWJCY0UNgHG_HW9YchltSx7rs66cfAw79VJLl3G38?includeGridData=false", - "body": null, - "headers": { - "User-Agent": [ - "python-requests/2.31.0" - ], - "Accept-Encoding": [ - "gzip, deflate" - ], - "Accept": [ - "*/*" - ], - "Connection": [ - "keep-alive" - ], - "authorization": [ - "" - ] - } - }, - "response": { - "status": { - "code": 200, - "message": "OK" - }, - "headers": { - "X-XSS-Protection": [ - "0" - ], - "X-Frame-Options": [ - "SAMEORIGIN" + "private" ], "x-l2-request-path": [ "l2-managed-6" ], - "X-Content-Type-Options": [ - "nosniff" - ], - "Content-Type": [ - "application/json; charset=UTF-8" - ], - "Cache-Control": [ - "private" - ], - "Transfer-Encoding": [ - "chunked" - ], - "Alt-Svc": [ - "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" - ], - "Date": [ - "Wed, 06 Sep 2023 21:14:07 GMT" - ], - "Server": [ - "ESF" - ], - "Vary": [ - "Origin", - "X-Origin", - "Referer" - ], "content-length": [ - "3345" - ] - }, - "body": { - "string": "{\n \"spreadsheetId\": \"1kUnWJCY0UNgHG_HW9YchltSx7rs66cfAw79VJLl3G38\",\n \"properties\": {\n \"title\": \"Test ClientTest test_access_private_spreadsheet\",\n \"locale\": \"en_US\",\n \"autoRecalc\": \"ON_CHANGE\",\n \"timeZone\": \"Etc/GMT\",\n \"defaultFormat\": {\n \"backgroundColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"padding\": {\n \"top\": 2,\n \"right\": 3,\n \"bottom\": 2,\n \"left\": 3\n },\n \"verticalAlignment\": \"BOTTOM\",\n \"wrapStrategy\": \"OVERFLOW_CELL\",\n \"textFormat\": {\n \"foregroundColor\": {},\n \"fontFamily\": \"arial,sans,sans-serif\",\n \"fontSize\": 10,\n \"bold\": false,\n \"italic\": false,\n \"strikethrough\": false,\n \"underline\": false,\n \"foregroundColorStyle\": {\n \"rgbColor\": {}\n }\n },\n \"backgroundColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n \"spreadsheetTheme\": {\n \"primaryFontFamily\": \"Arial\",\n \"themeColors\": [\n {\n \"colorType\": \"TEXT\",\n \"color\": {\n \"rgbColor\": {}\n }\n },\n {\n \"colorType\": \"BACKGROUND\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n {\n \"colorType\": \"ACCENT1\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.25882354,\n \"green\": 0.52156866,\n \"blue\": 0.95686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT2\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.91764706,\n \"green\": 0.2627451,\n \"blue\": 0.20784314\n }\n }\n },\n {\n \"colorType\": \"ACCENT3\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.9843137,\n \"green\": 0.7372549,\n \"blue\": 0.015686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT4\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.20392157,\n \"green\": 0.65882355,\n \"blue\": 0.3254902\n }\n }\n },\n {\n \"colorType\": \"ACCENT5\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 0.42745098,\n \"blue\": 0.003921569\n }\n }\n },\n {\n \"colorType\": \"ACCENT6\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.27450982,\n \"green\": 0.7411765,\n \"blue\": 0.7764706\n }\n }\n },\n {\n \"colorType\": \"LINK\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.06666667,\n \"green\": 0.33333334,\n \"blue\": 0.8\n }\n }\n }\n ]\n }\n },\n \"sheets\": [\n {\n \"properties\": {\n \"sheetId\": 0,\n \"title\": \"Sheet1\",\n \"index\": 0,\n \"sheetType\": \"GRID\",\n \"gridProperties\": {\n \"rowCount\": 1000,\n \"columnCount\": 26\n }\n }\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1kUnWJCY0UNgHG_HW9YchltSx7rs66cfAw79VJLl3G38/edit\"\n}\n" - } - } - }, - { - "request": { - "method": "DELETE", - "uri": "https://www.googleapis.com/drive/v3/files/1kUnWJCY0UNgHG_HW9YchltSx7rs66cfAw79VJLl3G38?supportsAllDrives=True", - "body": null, - "headers": { - "User-Agent": [ - "python-requests/2.31.0" - ], - "Accept-Encoding": [ - "gzip, deflate" - ], - "Accept": [ - "*/*" - ], - "Connection": [ - "keep-alive" - ], - "Content-Length": [ - "0" - ], - "authorization": [ - "" - ] - } - }, - "response": { - "status": { - "code": 204, - "message": "No Content" - }, - "headers": { - "X-XSS-Protection": [ - "0" - ], - "X-Frame-Options": [ - "SAMEORIGIN" - ], - "X-Content-Type-Options": [ - "nosniff" - ], - "Content-Type": [ - "text/html" - ], - "Cache-Control": [ - "no-cache, no-store, max-age=0, must-revalidate" - ], - "Alt-Svc": [ - "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" - ], - "Pragma": [ - "no-cache" - ], - "Date": [ - "Wed, 06 Sep 2023 21:14:08 GMT" - ], - "Expires": [ - "Mon, 01 Jan 1990 00:00:00 GMT" - ], - "Content-Length": [ - "0" - ], - "Server": [ - "ESF" - ], - "Vary": [ - "Origin, X-Origin" + "126" ] }, "body": { - "string": "" + "string": "{\n \"error\": {\n \"code\": 403,\n \"message\": \"The caller does not have permission\",\n \"status\": \"PERMISSION_DENIED\"\n }\n}\n" } } } diff --git a/tests/client_test.py b/tests/client_test.py index 02b3fa61f..32ef9db79 100644 --- a/tests/client_test.py +++ b/tests/client_test.py @@ -6,7 +6,6 @@ class ClientTest(GspreadTest): - """Test for gspread.client.""" @pytest.fixture(scope="function", autouse=True) @@ -119,19 +118,6 @@ def test_open_by_name_has_metadata(self): @pytest.mark.vcr() def test_access_private_spreadsheet(self): """tests that opening private spreadsheet returns SpreadsheetPermissionDenied""" - self.skipTest( - """ - APIs run up to timeout value. - With credentials, test passes, but takes ~260 seconds. - This is an issue with the back-off client. - See BackOffHTTPClient docstring in - `gspread/http_client.py` - > "will retry exponentially even when the error should - > raise instantly. Due to the Drive API that raises - > 403 (Forbidden) errors for forbidden access and - > for api rate limit exceeded." - """ - ) private_id = "1jIKzPs8LsiZZdLdeMEP-5ZIHw6RkjiOmj1LrJN706Yc" with self.assertRaises(PermissionError): self.gc.open_by_key(private_id) diff --git a/tests/conftest.py b/tests/conftest.py index c45f1b836..86944facd 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -38,7 +38,7 @@ def get_method_name(self_id): def ignore_retry_requests(response): - SKIP_RECORD = [403, 408, 429] + SKIP_RECORD = [408, 429] if response["status"]["code"] in SKIP_RECORD: return None # do not record