@@ -403,7 +403,7 @@ def batch(ctx, input, fields, output, format, exclude):
403403 resources = [resource .strip () for resource in input .readlines ()]
404404 bulk_results = process (resources , ipdata .bulk , fields )
405405
406- # Prepare CSV writing by expanding fieldnames eg. asn to asn, name, domain etc
406+ # Prepare CSV writing by expanding fieldnames eg. asn to [ asn, name, domain] etc
407407 csv_writer = None
408408 fieldnames = []
409409 for field in fields :
@@ -413,15 +413,15 @@ def batch(ctx, input, fields, output, format, exclude):
413413 for sub_field in ["asn" , "name" , "domain" , "route" , "type" ]
414414 ]
415415 continue
416- if field == "company" :
416+ elif field == "company" :
417417 fieldnames += [
418418 f"company_{ sub_field } "
419- for sub_field in ["asn" , " name" , "domain" , "network" , "type" ]
419+ for sub_field in ["name" , "domain" , "network" , "type" ]
420420 ]
421421 continue
422- if field == "threat" :
422+ elif field == "threat" :
423423 fieldnames += [
424- f"asn_ { sub_field } "
424+ f"threat_ { sub_field } "
425425 for sub_field in [
426426 "is_tor" ,
427427 "is_icloud_relay" ,
@@ -436,7 +436,7 @@ def batch(ctx, input, fields, output, format, exclude):
436436 ]
437437 ]
438438 continue
439- if field in ipdata .valid_fields :
439+ elif field in ipdata .valid_fields :
440440 fieldnames += [field ]
441441
442442 # Do lookups concurrenctly using threads in batches of 100 each
0 commit comments