dan dropped a line = line.rstrip(), not to worry, I picked it up for him.

This commit is contained in:
Promofaux 2016-10-02 17:39:37 +01:00
parent 14fc90579d
commit cc3fe5363a

View file

@ -47,7 +47,7 @@ import sqlite3
logfile = '/etc/pihole/pihole.2.eventHorizon.txt'
# Create the SQLite connection
conn = sqlite3.connect('/etc/pihole/pihole.db')
conn = sqlite3.connect('/etc/pihole/gravity.db')
# Python auto-handle commits, no need to call for commits manually
with conn:
@ -71,5 +71,6 @@ with conn:
# Parse the log file into the database
with open(logfile) as f:
for line in f:
line = line.rstrip()
sql = "INSERT INTO gravity (domain) VALUES (?)"
c.execute(sql, (line,))