Skip to content

Commit 94dbe5c

Browse files
authored
Merge pull request #3171 from mkelley/mpc-exception-format
Format MPC ephemeris error response as text (i.e., strip HTML tags).
2 parents 23d3471 + ce16e78 commit 94dbe5c

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGES.rst

+4
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ mpc
8989
- Remove ``comettype`` parameter from ``MPC.get_observations`` without
9090
deprecation: it was undocumented, ignored, and had no effect. [#3089]
9191

92+
- When ``MPC.get_ephemeris`` raises an ``InvalidQueryError`` message, instead of
93+
returning the original HTML formatted text, strip the HTML tags and return a
94+
plain text message. [#3171]
95+
9296
nvas
9397
^^^^
9498

astroquery/mpc/core.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ def _parse_result(self, result, **kwargs):
10471047
content = result.content.decode()
10481048
table_start = content.find('<pre>')
10491049
if table_start == -1:
1050-
raise InvalidQueryError(content)
1050+
raise InvalidQueryError(BeautifulSoup(content, "html.parser").get_text())
10511051
table_end = content.find('</pre>')
10521052
text_table = content[table_start + 5:table_end]
10531053
SKY = 'raty=a' in result.request.body

0 commit comments

Comments
 (0)