Skip to content
Snippets Groups Projects
Verified Commit 84005eb8 authored by David Hoese's avatar David Hoese
Browse files

Add wunderground upload timeout

parent 66784e22
No related branches found
No related tags found
No related merge requests found
......@@ -246,12 +246,17 @@ def main():
print(url)
else:
LOG.info("Uploading new data to wunderground...")
resp = requests.post(url)
if resp.status_code != 200:
warnings.warn('Data failed to upload to {0} with status code {1}: {2}'.format(
url, resp.status_code, resp.text))
else:
LOG.info("Upload successful")
try:
resp = requests.post(url, timeout=15)
if resp.status_code != 200:
LOG.warning('Data failed to upload to {0} with status code {1}: {2}'.format(
url, resp.status_code, resp.text))
else:
LOG.info("Upload successful")
except requests.Timeout:
LOG.error("Data upload to wunderground timed out", exc_info=True)
except requests.ConnectionError:
LOG.error("Data upload to wunderground had a connection error", exc_info=True)
if args.sleep_interval:
time.sleep(args.sleep_interval)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment