module name conflict

This commit is contained in:
rscmbbng 2018-12-02 19:31:23 +01:00
parent 7912ef9f6b
commit ca30b15ca7

View File

@ -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()