def _parse_ip_line(self, country_code, type, line):
try:
address, prefix, date, status, org_id = line.split("|")
- except:
- logging.warning("Unhandled line format: %s" % line)
- return
+ except ValueError:
+ org_id = None
+
+ # Try parsing the line without org_id
+ try:
+ address, prefix, date, status = line.split("|")
+ except ValueError:
+ logging.warning("Unhandled line format: %s" % line)
+ return
# Skip anything that isn't properly assigned
if not status in ("assigned", "allocated"):
def _parse_asn_line(self, country_code, line):
try:
asn, dunno, date, status, org_id = line.split("|")
- except:
- logging.warning("Could not parse line: %s" % line)
- return
+ except ValueError:
+ org_id = None
+
+ # Try parsing the line without org_id
+ try:
+ asn, dunno, date, status = line.split("|")
+ except ValueError:
+ logging.warning("Could not parse line: %s" % line)
+ return
# Skip anything that isn't properly assigned
if not status in ("assigned", "allocated"):