class GZipCSVReader:

    def __init__(self, filename):
        self.gzfile = gzip.open(filename)
self.reader = csv.DictReader(self.gzfile)

def next(self):
    return self.reader.__next__()

def close(self):
    self.gzfile.close()

def __iter__(self):
    return self.reader.__iter__()
Using csvreader against a gzipped file in Python