Skip to content

Commit ca797ff

Browse files
committed
Better handling of missing or empty columns.
This patch touches #430. Contributor: @Yuki2718
1 parent 7a91f5f commit ca797ff

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

PyFunceble/dataset/csv_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def get_content(self) -> Generator[Optional[dict], None, None]:
211211
row["tested_at"] = datetime.fromisoformat(
212212
row["tested_at"]
213213
).astimezone(timezone.utc)
214-
except (TypeError, ValueError):
214+
except (TypeError, ValueError, KeyError):
215215
row["tested_at"] = datetime.now(timezone.utc) - timedelta(
216216
days=365
217217
)

PyFunceble/dataset/inactive/csv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def get_to_retest(
8787
date_of_inclusion = datetime.fromisoformat(
8888
dataset["tested_at"]
8989
).astimezone(timezone.utc)
90-
except (TypeError, ValueError):
90+
except (TypeError, ValueError, KeyError):
9191
date_of_inclusion = datetime.now(timezone.utc) - timedelta(days=365)
9292
else:
9393
date_of_inclusion = dataset["tested_at"]

PyFunceble/dataset/whois/csv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def get_content(self) -> Generator[Optional[dict], None, None]:
101101
for row in super().get_content():
102102
try:
103103
row["epoch"] = float(row["epoch"])
104-
except (TypeError, ValueError):
104+
except (TypeError, ValueError, KeyError):
105105
continue
106106

107107
yield row

0 commit comments

Comments
 (0)