fix invalid card number handler
parent
347db3a8e0
commit
eda0f959dd
5
utils.py
5
utils.py
|
@ -16,7 +16,10 @@ async def tk_balance(card_number: int):
|
|||
file = open("temp.xml", "w+")
|
||||
file.write(text)
|
||||
file.close()
|
||||
balance = ElementTree.parse("temp.xml").findtext(".//pbtext").replace("Билет длительного пользования", "").replace(" руб.", "")
|
||||
try:
|
||||
balance = ElementTree.parse("temp.xml").findtext(".//pbtext").replace("Билет длительного пользования", "").replace(" руб.", "")
|
||||
except AttributeError:
|
||||
return
|
||||
if not balance:
|
||||
return
|
||||
return int(balance)
|
||||
|
|
Loading…
Reference in New Issue