Skip to content

Commit 16ea858

Browse files
committed
Added failsafes for characer houses parsing
- An update broke the way they are displayed, causing the entire character parsing to fail. For the time being no house data is displayed.
1 parent cc0e4be commit 16ea858

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tibiapy/character.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,14 @@ def _parse_character_information(self, rows):
420420
# This is a special case cause we need to see the link
421421
if field == "house":
422422
house_text = value
423-
paid_until = house_regexp.search(house_text).group(1)
423+
m = house_regexp.search(house_text)
424+
if not m:
425+
continue
426+
paid_until = m.group(1)
424427
paid_until_date = parse_tibia_date(paid_until)
425428
house_link = cols_raw[1].find('a')
429+
if not house_link:
430+
continue
426431
url = urllib.parse.urlparse(house_link["href"])
427432
query = urllib.parse.parse_qs(url.query)
428433
houses.append({"id": int(query["houseid"][0]), "name": house_link.text.strip(),

0 commit comments

Comments
 (0)