Skip to content

Commit 6239e44

Browse files
Update parse-geofeed.py
1 parent 45c7425 commit 6239e44

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

scripts/parse-geofeed.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def parse(geofeed_csv, json_file, ipver):
3737
for row in csv_reader:
3838
# Ensure we skip over any rows which are comments
3939
try:
40-
if row[0].startswith("#"):
40+
if row[0].startswith("#") or row[0] is None:
4141
continue
4242
except IndexError:
4343
continue
@@ -47,11 +47,11 @@ def parse(geofeed_csv, json_file, ipver):
4747
print(f"Geofeed file: {geofeed_csv} has rows that are incomplete.")
4848
continue
4949

50-
# Record the row
51-
if row[0] is None:
50+
try:
51+
network = ipaddress.ip_network(row[0], strict=False)
52+
except ValueError:
5253
continue
5354

54-
network = ipaddress.ip_network(row[0], strict=False)
5555
if (ipver == "ip" and network.version == 4) or (
5656
ipver == "ipv6" and network.version == 6
5757
):

0 commit comments

Comments
 (0)