Skip to content

Commit

Permalink
Add try-except clause to text parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
andredelft committed Jan 23, 2024
1 parent cef7118 commit f514022
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions heidegger_index/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,15 @@ def load_work_text(self):
+ self.urn
)
p_response = requests.get(p_link)
parsed_xml = BeautifulSoup(p_response.text, "html.parser")
self.perseus_content = parsed_xml.p.contents[-1].string

try:
# TODO: URN-based parsing, or strip bibl & label contents
parsed_xml = BeautifulSoup(p_response.text, "html.parser")
perseus_content = parsed_xml.p.contents[-1].string
except AttributeError:
pass
else:
self.perseus_content = perseus_content

@property
def display(self):
Expand Down

0 comments on commit f514022

Please sign in to comment.