From c7a1c653d9a14a1fec817ae9b95f1b6c71e4c2d6 Mon Sep 17 00:00:00 2001 From: Abhay Rana Date: Fri, 3 Oct 2014 19:09:35 +0530 Subject: [PATCH] Uses constants in chrome config --- hackertray/chrome.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hackertray/chrome.py b/hackertray/chrome.py index cda5131..e08d9a4 100644 --- a/hackertray/chrome.py +++ b/hackertray/chrome.py @@ -5,11 +5,12 @@ import os import sys class Chrome: + HISTORY_TMP_LOCATION = '/tmp/hackertray.chrome' @staticmethod def search(urls, config_folder_path): Chrome.setup(config_folder_path) - conn = sqlite3.connect('/tmp/hackertray.chrome') - db = conn.cursor() + conn = sqlite3.connect(Chrome.HISTORY_TMP_LOCATION) + db = conn.cursor() result = [] for url in urls: db_result = db.execute('SELECT url from urls WHERE url=:url',{"url":url}) @@ -17,7 +18,7 @@ class Chrome: result.append(False) else: result.append(True) - os.remove('/tmp/hackertray.chrome') + os.remove(Chrome.HISTORY_TMP_LOCATION) return result @staticmethod def setup(config_folder_path): @@ -25,4 +26,4 @@ class Chrome: if not os.path.isfile(file_name): print("ERROR: ", "Could not find Chrome history file", file=sys.stderr) sys.exit(1) - shutil.copyfile(file_name, '/tmp/hackertray.chrome') \ No newline at end of file + shutil.copyfile(file_name, Chrome.HISTORY_TMP_LOCATION)