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