diff options
Diffstat (limited to 'mitmproxy/io/db.py')
| -rw-r--r-- | mitmproxy/io/db.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/mitmproxy/io/db.py b/mitmproxy/io/db.py index 01d30aa2..ea42e08b 100644 --- a/mitmproxy/io/db.py +++ b/mitmproxy/io/db.py @@ -2,17 +2,18 @@ import sqlite3 import os from mitmproxy.io import protobuf -from mitmproxy.http import HTTPFlow -from mitmproxy import exceptions -class DbHandler: +class DBHandler: """ This class is wrapping up connection to SQLITE DB. """ - def __init__(self, db_path="/tmp/tmp.sqlite"): + def __init__(self, db_path, mode='load'): + if mode == 'write': + if os.path.isfile(db_path): + os.remove(db_path) self.db_path = db_path self._con = sqlite3.connect(self.db_path) self._c = self._con.cursor() |
