fix invalid card number handler
This commit is contained in:
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 = open("temp.xml", "w+")
|
||||||
file.write(text)
|
file.write(text)
|
||||||
file.close()
|
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:
|
if not balance:
|
||||||
return
|
return
|
||||||
return int(balance)
|
return int(balance)
|
||||||
|
Loading…
Reference in New Issue
Block a user