-
-
Save waveform80/5583733 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def process_iis_directory(d): | |
print('Processing IIS directory %s' % d) | |
for entry in os.listdir(d): | |
entry = os.path.join(d, entry) | |
if entry.endswith('.gz'): | |
print('Processing %s into CSV' % entry) | |
with gzip.open(entry, 'rb') as uncompressed, \ | |
io.BufferedReader(uncompressed) as buffered, \ | |
io.TextIOWrapper(buffered, encoding='latin1') as infile, \ | |
io.open(os.path.splitext(entry)[0] + '.csv', 'wb') as outfile, \ | |
iis.IISSource(infile) as source, \ | |
csv.CSVTarget(outfile) as target: | |
for row in source: | |
target.write(row) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment