The read operation timed out for google spreadsheet

454 views
Skip to first unread message

Luis Zamora

unread,
Jul 10, 2023, 11:58:30 AM7/10/23
to Google Ads API and AdWords API Forum
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


Google Ads API Forum Advisor

unread,
Jul 10, 2023, 2:57:13 PM7/10/23
to luis....@everymundo.com, adwor...@googlegroups.com
Hi,

Thank you for raising this concern to our team.

Upon seeing your provided logs, it appears that the error you are experiencing is a client library related error. Also, it seems that as per your service definition, you are not using the Google Ads API client library (https://developers.google.com/google-ads/api/docs/client-libs?hl=en). Kindly note that our team specializes in Google Ads API related concerns and technical implementations only. That being said, you may try reaching out to the Python client library authors via this Github issues link (https://github.com/googleads/google-ads-python/issues) for assistance regarding this issue.

You may also check the below guides for more information about this:
Regards,

This message is in relation to case "ref:_00D1U1174p._5004Q2n5t2o:ref"

Thanks,
 
Google Logo Google Ads API Team


Reply all
Reply to author
Forward
0 new messages