Code: Select all
{"remaining": 123, "total": 456}
Code: Select all
OSError
Restart again, and it works.
The truly puzzling thing is that the code which runs this is basically stateless (it does not save information to
Code: Select all
/flash
I've tried:
- waiting in between runs, in cases there's some kind of sticky state. Waits up to the limits of my patience (5 mins or so) seem to have no effect
- looking at the logs for the server to see if there anomalies in the requests. They appear to be well-formed
Code: Select all
75.172.128.250 - - [15/Nov/2019:01:22:25 +0000] "GET /check/Dad HTTP/1.1" 200 32 "-" "-" "75.172.128.250" response-time=0.002
- adding code to make sure the NIC is still connected. It is.
The part of the loop which is trying to talk to the server is like this;
Code: Select all
if LOGGED_IN is not None and len(LOGGED_IN):
req = 'http://theodox.pythonanywhere.com/check/{}'.format(LOGGED_IN)
print("checking status")
response = None
try:
response = requests.get(req)
info = response.json()
except OSError:
error = "request timeout"
print(error)
LOGGED_IN = None
REMAIN = 0
TOTAL = 0
time.sleep(1)
else:
REMAIN = info['remaining']
TOTAL = info['total']
finally:
del response