module name conflict
This commit is contained in:
parent
7912ef9f6b
commit
ca30b15ca7
9
slog.py
9
slog.py
@ -4,7 +4,7 @@ import sqlite3
|
||||
|
||||
now = datetime.datetime.now()
|
||||
day = now.strftime('%F')
|
||||
time = now.strftime('%H:%M')
|
||||
the_time = now.strftime('%H:%M')
|
||||
|
||||
url = 'https://solar.lowtechmagazine.com/api/stats.json'
|
||||
|
||||
@ -13,7 +13,6 @@ if not os.path.exists('stats.db'):
|
||||
c = db.cursor()
|
||||
c.execute("""CREATE TABLE stats(date text, time text, error text, server text)
|
||||
""")
|
||||
db.commit()
|
||||
else:
|
||||
db = sqlite3.connect('stats.db')
|
||||
c = db.cursor()
|
||||
@ -36,7 +35,6 @@ except URLError as e:
|
||||
data = None
|
||||
pass
|
||||
|
||||
|
||||
else:
|
||||
# everything is fine
|
||||
data = response.read().decode('utf-8')
|
||||
@ -44,9 +42,12 @@ else:
|
||||
|
||||
if error:
|
||||
error = error.args[1]
|
||||
|
||||
|
||||
time.sleep(1)
|
||||
c.execute("""INSERT INTO stats VALUES(?,?,?,?)""", (day, time, error, data))
|
||||
c.execute("""INSERT INTO stats VALUES(?,?,?,?)""", (day, the_time, error, data))
|
||||
time.sleep(1)
|
||||
db.commit()
|
||||
time.sleep(1)
|
||||
db.close()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user