Es wird nun nur noch der entsprechende Tag abgefragt und gespeichert (Traffic)

This commit is contained in:
hubobel 2017-12-01 19:46:22 +01:00
parent 4f37bfdceb
commit d71970f4ce

View file

@ -1,11 +1,17 @@
import requests import requests
import pymysql import pymysql
import time
connection = pymysql.connect(db="hubobel", connection = pymysql.connect(db="hubobel",
user="hubobel", user="hubobel",
passwd="polier2003", passwd="polier2003",
host='10.0.1.59',charset='utf8') host='10.0.1.59',charset='utf8')
cursor = connection.cursor() cursor = connection.cursor()
wtag = time.strftime('%w')
if wtag == 3:
try: try:
cursor.execute("""CREATE TABLE mittwoch ( cursor.execute("""CREATE TABLE mittwoch (
datum Text, z1 INTEGER, z2 INTEGER, z3 INTEGER, z4 INTEGER, z5 INTEGER, z6 INTEGER, sz INTEGER, super6 INTEGER, spiel77 INTEGER)""") datum Text, z1 INTEGER, z2 INTEGER, z3 INTEGER, z4 INTEGER, z5 INTEGER, z6 INTEGER, sz INTEGER, super6 INTEGER, spiel77 INTEGER)""")
@ -25,6 +31,7 @@ if resp == 0:
cursor.execute(sql) cursor.execute(sql)
connection.commit() connection.commit()
if wtag == 6:
try: try:
cursor.execute("""CREATE TABLE samstag ( cursor.execute("""CREATE TABLE samstag (
datum Text, z1 INTEGER, z2 INTEGER, z3 INTEGER, z4 INTEGER, z5 INTEGER, z6 INTEGER, sz INTEGER, super6 INTEGER, spiel77 INTEGER)""") datum Text, z1 INTEGER, z2 INTEGER, z3 INTEGER, z4 INTEGER, z5 INTEGER, z6 INTEGER, sz INTEGER, super6 INTEGER, spiel77 INTEGER)""")
@ -44,6 +51,7 @@ if resp == 0:
cursor.execute(sql) cursor.execute(sql)
connection.commit() connection.commit()
if wtag == 5:
try: try:
cursor.execute("""CREATE TABLE euro ( cursor.execute("""CREATE TABLE euro (
datum Text, z1 INTEGER, z2 INTEGER, z3 INTEGER, z4 INTEGER, z5 INTEGER, sz1 INTEGER, sz2 INTEGER )""") datum Text, z1 INTEGER, z2 INTEGER, z3 INTEGER, z4 INTEGER, z5 INTEGER, sz1 INTEGER, sz2 INTEGER )""")
@ -62,5 +70,6 @@ if resp == 0:
cursor.execute(sql) cursor.execute(sql)
connection.commit() connection.commit()
cursor.close() cursor.close()
connection.close() connection.close()