Skip to content

Commit

Permalink
Removed test code from view
Browse files Browse the repository at this point in the history
  • Loading branch information
suidpit committed Jun 30, 2018
1 parent cbb6e38 commit 204faa1
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions mitmproxy/addons/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,19 +447,12 @@ def load_file(self, path: mitmproxy.types.Path) -> None:
Load flows into the view, without processing them with addons.
"""
try:
if path.endswith(".sqlite"):
dh = io.DbHandler(path)
for f in dh.load():
self.add([f.copy()])
else:
with open(path, "rb") as f:
for i in io.FlowReader(f).stream():
# Do this to get a new ID, so we can load the same file N times and
# get new flows each time. It would be more efficient to just have a
# .newid() method or something.
self.add([i.copy()])
except exceptions.TypeError as e:
ctx.log.error(str(e))
with open(path, "rb") as f:
for i in io.FlowReader(f).stream():
# Do this to get a new ID, so we can load the same file N times and
# get new flows each time. It would be more efficient to just have a
# .newid() method or something.
self.add([i.copy()])
except IOError as e:
ctx.log.error(e.strerror)
except exceptions.FlowReadException as e:
Expand Down

0 comments on commit 204faa1

Please sign in to comment.