File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -251,8 +251,14 @@ def _parse_result(self, response):
251
251
252
252
if 'ERROR: request form contains no information' in response .text :
253
253
raise ValueError (f"The server returned an error. Please check the URL. The full error message is { response .text } " )
254
+ elif 'ERROR' in response .text :
255
+ raise ValueError (f"The server returned an error. The full error message is { response .text } " )
254
256
255
- data = StringIO (BeautifulSoup (response .text , features = 'html5lib' ).find ('pre' ).text .strip ())
257
+ html_pre = BeautifulSoup (response .text , features = 'html5lib' ).find ('pre' )
258
+ if html_pre is None :
259
+ raise ValueError ("Data format not recognized. The <pre> tag was missing from the response." )
260
+
261
+ data = StringIO (html_pre .text .strip ())
256
262
# `header` is e.g.:
257
263
# "u'-LAMBDA-VAC-ANG-|-SPECTRUM--|TT|--------TERM---------|---J-J---|----LEVEL-ENERGY--CM-1----'"
258
264
# `colnames` is then
You can’t perform that action at this time.
0 commit comments