3

I have a python script which is running all day looking for messages with specific data and make specific tasks with it.

I just make one login at the start of the script/service and that's it, I know this is not the problem because the same API renovates the token automatically. Script crashes at random times at the moment.

The error starts with line:

results = service.users().messages().list(userId='me', includeSpamTrash=True, maxResults=100, q='SECRET QUERY HERE').execute()

Last lines from the last crash:

  File "/usr/local/lib/python3.4/dist-packages/httplib2/__init__.py", line 1533, in _conn_request
    response = conn.getresponse()
  File "/usr/lib/python3.4/http/client.py", line 1208, in getresponse
    response.begin()
  File "/usr/lib/python3.4/http/client.py", line 380, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.4/http/client.py", line 342, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.4/socket.py", line 374, in readinto
    return self._sock.recv_into(b)
  File "/usr/lib/python3.4/ssl.py", line 769, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/lib/python3.4/ssl.py", line 641, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
exiz
  • 93
  • 6
  • Hey exiz ,i have been stuck with the same problem for quite some time now , can you tell me if you found the answer to the problem – Sachin Rajput Mar 31 '21 at 18:35
  • @SachinRajput Yes, I did fix it but was a long time ago, just do it like the official docs (there was an update after I had this problem I believe), I did a project recently from scratch following the doc and I didn't have any problems. https://developers.google.com/gmail/api/quickstart/python – exiz Apr 05 '21 at 15:52

0 Answers0