diff --git a/app/scrapers/axis.py b/app/scrapers/axis.py index 31ca7b1..4a9c290 100644 --- a/app/scrapers/axis.py +++ b/app/scrapers/axis.py @@ -268,7 +268,7 @@ def fetch_data( @staticmethod def parse_details(expense: Expense) -> Transaction: - details = expense.details.replace("M/s", "M.s") + details = str(expense.details).replace("M/s", "M.s") axis_id = os.getenv("AXIS_CUSTOMID", "") if details.startswith("UPIRECONP2PM/"): _, transaction_id, _ = (each.strip() for each in details.split("/", 2)) @@ -291,8 +291,8 @@ def parse_details(expense: Expense) -> Transaction: extra = details.split()[-1] to_name_ctf = re.search("[A-Z]+", extra) to_name_str = to_name_ctf.group() if to_name_ctf else "" - transaction_id = re.search("[0-9]+", extra) - transaction_id = transaction_id.group() if transaction_id else "" + transaction_id_ = re.search("[0-9]+", extra) + transaction_id = transaction_id_.group() if transaction_id_ else "" transaction = Transaction( transaction_type="UPI", transaction_id=transaction_id, @@ -496,7 +496,7 @@ def fetch_data( @staticmethod def parse_details(expense: Expense) -> Transaction: - details = expense.details + details = str(expense.details) merchant = details.split(",", 1)[0] ignore = bool(details.startswith("MB PAYMENT")) return Transaction( diff --git a/app/scrapers/base.py b/app/scrapers/base.py index 769bc92..1e2d31a 100644 --- a/app/scrapers/base.py +++ b/app/scrapers/base.py @@ -23,7 +23,8 @@ class Transaction: class Source: name = "base" columns: dict[str, None | str | list[str]] = {} - date_format: str | None = None + date_format: str = "" + dtypes: dict[str, str] = {} @staticmethod def parse_details(expense: Expense) -> Transaction: diff --git a/app/scrapers/cash.py b/app/scrapers/cash.py index 92673d8..baf9b55 100644 --- a/app/scrapers/cash.py +++ b/app/scrapers/cash.py @@ -36,7 +36,7 @@ def fetch_data( @staticmethod def parse_details(expense: Expense) -> Transaction: - details = expense.details + details = str(expense.details) remarks, category_name = (each.strip() for each in details.split("/")) return Transaction( transaction_type="Cash",