Parsing postfix
This commit is contained in:
@@ -6,20 +6,33 @@ from parsing.base import ParsingBase
|
||||
|
||||
|
||||
class Parsing(ParsingBase):
|
||||
def __init__(self, objects):
|
||||
def __init__(self, objects, arguments):
|
||||
self._parsing = dict()
|
||||
self._reports = dict()
|
||||
self._objects = objects
|
||||
self._postfix_file = arguments["postfix_file"]
|
||||
print(self._objects)
|
||||
print(arguments)
|
||||
|
||||
def runParsing(self):
|
||||
# Generate report
|
||||
self._constructReports()
|
||||
|
||||
|
||||
print(self._reports)
|
||||
# Check if the file exist
|
||||
try:
|
||||
with open(self._postfix_file, 'rb') as fdata:
|
||||
self._parseFile(fdata)
|
||||
except FileNotFoundError:
|
||||
print("No postfix file found. Add into the report")
|
||||
pass
|
||||
|
||||
def _parseFile(self):
|
||||
pass
|
||||
def _parseFile(self, fdata):
|
||||
data = fdata.read()
|
||||
lines = data.splitlines()
|
||||
|
||||
for line in lines:
|
||||
line = line.decode('utf-8')
|
||||
print(line)
|
||||
|
||||
def _generateReport(self, objects):
|
||||
# We can generate the report
|
||||
|
||||
@@ -15,6 +15,9 @@ class Parsing(ParsingBase):
|
||||
# Generate report
|
||||
self._constructReports()
|
||||
|
||||
# TODO:
|
||||
# We are not parse file and process. We parse file and process and for each
|
||||
# line, we try to find in the file and in the process
|
||||
for audit in self._audit:
|
||||
if audit['audit'] == 'file':
|
||||
with open(audit['value'], 'rb') as fdata:
|
||||
|
||||
Reference in New Issue
Block a user