Skip to content

Commit

Permalink
Fixes list_passband_online_history()
Browse files Browse the repository at this point in the history
The call to this function expected to receive a dict from the server but it instead received a list. The list is now converted to a dict. It does so by parsing a fixed number of characters to determine a date string, which might be problematic for non-EN locales but I can't think of any robust way to make this work automatically.
  • Loading branch information
aprsa committed Oct 28, 2024
1 parent 6decdf5 commit fdae4c2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions phoebe/atmospheres/passbands.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

# define the URL to query for online passbands. See tables.phoebe-project.org
# repo for the source-code of the server
_url_tables_server = 'http://tables.phoebe-project.org'
_url_tables_server = 'http://staging.phoebe-project.org'
# comment out the following line if testing tables.phoebe-project.org server locally:
# _url_tables_server = 'http://localhost:5555'

Expand Down Expand Up @@ -2192,7 +2192,8 @@ def list_passband_online_history(passband, since_installed=True):
return {str(time.ctime()): "could not retrieve history entries"}
else:
try:
all_history = json.loads(resp.read().decode('utf-8'), object_pairs_hook=parse_json).get('passband_history', {}).get(passband, {})
history = json.loads(resp.read().decode('utf-8'), object_pairs_hook=parse_json).get('passband_history', {}).get(passband, {})
all_history = {entry[:24]: entry[25:].strip() for entry in history}
except Exception as err:
msg = "Parsing response from online passbands at {} failed.".format(_url_tables_server)
msg += " Original error from json.loads: {} {}".format(err.__class__.__name__, str(err))
Expand Down

0 comments on commit fdae4c2

Please sign in to comment.