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

Merge branch 'wunderground-timeout' into 'master'

Add wunderground upload timeout

See merge request metobs/AossTower!5
parents 66784e22 84005eb8
No related branches found
No related tags found
No related merge requests found
...@@ -246,12 +246,17 @@ def main(): ...@@ -246,12 +246,17 @@ def main():
print(url) print(url)
else: else:
LOG.info("Uploading new data to wunderground...") LOG.info("Uploading new data to wunderground...")
resp = requests.post(url) try:
if resp.status_code != 200: resp = requests.post(url, timeout=15)
warnings.warn('Data failed to upload to {0} with status code {1}: {2}'.format( if resp.status_code != 200:
url, resp.status_code, resp.text)) LOG.warning('Data failed to upload to {0} with status code {1}: {2}'.format(
else: url, resp.status_code, resp.text))
LOG.info("Upload successful") 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: if args.sleep_interval:
time.sleep(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