Skip to content

The read operation timed out reading a google spreadsheet #2186

Open
@lzamora2798

Description

@lzamora2798

Hi Google team, I am facing an issue when executing this line in Python,

from googleapiclient.discovery import build

service = build('sheets', 'v4', credentials=creds,cache_discovery=False)    
sheet_metadata = service.spreadsheets().get(spreadsheetId=spreadsheet_id).execute()

the final issue on the log is socket.timeout: The read operation timed out
this issue is very rare when executing this issue, as we run this code more than ten times per day. I want to know why this happens and what can I do to resolve this.

we use this version of the module google-api-python-client==2.90.0
and we run this in a lambda on aws

this is the full log of the issue.

Traceback (most recent call last):
File "/var/task/lambdas/createSheet.py", line 66, in _update_spreadsheet
sheet_metadata = service.spreadsheets().get(spreadsheetId=spreadsheet_id).execute()
File "/opt/python/lib/python3.9/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper
return wrapped(*args, **kwargs)
File "/opt/python/lib/python3.9/site-packages/googleapiclient/http.py", line 923, in execute
resp, content = _retry_request(
File "/opt/python/lib/python3.9/site-packages/googleapiclient/http.py", line 222, in _retry_request
raise exception
File "/opt/python/lib/python3.9/site-packages/googleapiclient/http.py", line 191, in _retry_request
resp, content = http.request(uri, method, *args, **kwargs)
File "/opt/python/lib/python3.9/site-packages/google_auth_httplib2.py", line 218, in request
response, content = self.http.request(
File "/opt/python/lib/python3.9/site-packages/httplib2/__init__.py", line 1701, in request
(response, content) = self._request(
File "/opt/python/lib/python3.9/site-packages/httplib2/__init__.py", line 1421, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "/opt/python/lib/python3.9/site-packages/httplib2/__init__.py", line 1373, in _conn_request
response = conn.getresponse()
File "/var/lang/lib/python3.9/http/client.py", line 1377, in getresponse
response.begin()
File "/var/lang/lib/python3.9/http/client.py", line 320, in begin
version, status, reason = self._read_status()
File "/var/lang/lib/python3.9/http/client.py", line 281, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/var/lang/lib/python3.9/socket.py", line 704, in readinto
return self._sock.recv_into(b)
File "/var/lang/lib/python3.9/ssl.py", line 1242, in recv_into
return self.read(nbytes, buffer)
File "/var/lang/lib/python3.9/ssl.py", line 1100, in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions