LBNL-ETA / pyWinCalc

Other
27 stars 10 forks source link

pyWinCalc: Fix error message when there is no valid API key for the igsdb #32

Open RDmitchell opened 1 year ago

RDmitchell commented 1 year ago

From Christian Mon, Nov 21, 1:26 PM


Stephen,

I can run PyWinCalc on my Mac, but we should fix this error message: python3 igsdb_double_clear_glass.py Traceback (most recent call last): File "igsdb_double_clear_glass.py", line 31, in generic_clear_3mm_glass = pywincalc.parse_json(generic_clear_3mm_glass_igsdb_response.content) RuntimeError: Unable to parse json. It does not appear to be either of the two recognized formats. Currently only IGSDB v1 and v2 formats are supported.

You get this message if you haven't put an IGSDB API key in igsdb_interaction.py. There is nothing in the README about this on GitHub. We should at least have a decent error message that suggests that maybe you don't have your API key set (print "Your API Key"+igsdb_api_token)

RDmitchell commented 1 year ago

From Stephen Mon, Nov 21, 2:07 PM


Interacting with the IGSDB is not part of pywincalc's current functionality. pywincalc does not know anything about urls or managing API keys.

You are getting that error message because you have asked pywincalc to try to convert a string that is probably something similar to "403 Forbidden" into product data. Which it cannot do. But it also cannot convert "404 Not Found" or "503 Service Unavailable" or the contents of other random strings.