]> git.ipfire.org Git - location/libloc.git/commitdiff
importer: Convert the file handle to text before passing to the CSV parser
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 7 Mar 2024 14:03:16 +0000 (14:03 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 7 Mar 2024 14:03:16 +0000 (14:03 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/scripts/location-importer.in

index c9fd9a8edf47969f45a985ff9b5bfbaa89575442..88f422f03dd329e85775cfbb6afa9a8ade1d8841 100644 (file)
@@ -22,6 +22,7 @@ import asyncio
 import csv
 import functools
 import http.client
+import io
 import ipaddress
 import json
 import logging
@@ -964,6 +965,9 @@ class CLI(object):
                        self._parse_line(line, source, countries)
 
        async def _import_arin_as_names(self, source, countries, f, *args):
+               # Wrap the data to text
+               f = io.TextIOWrapper(f)
+
                # Walk through the file
                for line in csv.DictReader(f, dialect="arin"):
                        log.debug("Processing object: %s" % line)