diff --git a/lotto2py.py b/lotto2py.py index 9777499..710c8fd 100644 --- a/lotto2py.py +++ b/lotto2py.py @@ -2,6 +2,7 @@ import requests from bs4 import BeautifulSoup import re from datetime import datetime +import pymysql wochentag = datetime.today().weekday() @@ -82,6 +83,13 @@ print("Super 6 :", super6) lottozahlen.sort() ab = 'Z' cd = 1 +subber6 ='' +game77='' +for i in super6: + subber6 = subber6 + str(i) +for i in spiel77: + game77 = game77 + str(i) + for i in lottozahlen: print(i) ef=str((ab+str(cd))) @@ -89,8 +97,27 @@ for i in lottozahlen: cd = cd +1 Lottozahlen['Datum'] = datum_woche Lottozahlen['Superzahl'] = superzahl -Lottozahlen['Spiel77'] = spiel77 -Lottozahlen['Super6'] = super6 +Lottozahlen['Spiel77'] = int(game77) +Lottozahlen['Super6'] = int(subber6) print(Lottozahlen) +data = Lottozahlen +connection = pymysql.connect(db="hubobel", + user="hubobel", + passwd="polier2003", + host='10.0.1.123',charset='utf8') +cursor = connection.cursor() + +sql = "INSERT INTO `6aus49`(`datum`, `z1`, `z2`, `z3`, `z4`, `z5`, `z6`, `sz`, `super6`, `spiel77`) VALUES" \ + " ('" + str(data['Datum']) + "','" + str(data['Z1']) + "','" + str(data['Z2']) + "','" + str(data['Z3']) + \ + "','" + str(data['Z4']) + "','" + str(data['Z5']) + "','" + str(data['Z6']) + "','" + str(data['Superzahl']) + \ + "','" + str(data['Super6']) + "','" + str(data['Spiel77']) + "')" +sql_q = "SELECT * FROM 6aus49 WHERE datum like '%" + data['Datum'] + "%'" +resp = cursor.execute(sql_q) +if resp == 0: + cursor.execute(sql) + +connection.commit() +cursor.close() +connection.close() notify_telegram(str(Lottozahlen))