Skip to content

Commit

Permalink
PWV HTTP Requests Error (#563)
Browse files Browse the repository at this point in the history
* add try/except catch for failed http req's

* fix typo in log.info message

* remove try/except in wrong part of loop

* fix pass error to continue

* remove info message

* update session.data to be more clean
  • Loading branch information
sanahabhimani authored Nov 8, 2023
1 parent 49ec089 commit 6f429cc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions socs/agents/ucsc_radiometer/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ def acq(self, session, params=None):
session.set_status('running')

while self.take_data:
r = requests.get(self.url)
try:
r = requests.get(self.url)
except ValueError:
pm.sleep()
continue
data = r.json()
last_pwv = data['pwv']
last_timestamp = data['timestamp']
Expand All @@ -87,9 +91,7 @@ def acq(self, session, params=None):
self.last_published_reading = (last_pwv, last_timestamp)

session.data = {"timestamp": last_timestamp,
"pwv": {}}

session.data['pwv'] = last_pwv
"pwv": last_pwv}

if params['test_mode']:
break
Expand Down

0 comments on commit 6f429cc

Please sign in to comment.