WebApp
This commit is contained in:
parent
c9b4ee7af6
commit
844967f578
4 changed files with 501 additions and 7 deletions
57
lotto2py.py
57
lotto2py.py
|
|
@ -71,6 +71,10 @@ def Euro():
|
|||
bb = 'Eurozahl' + str(aa)
|
||||
ZahlenEuro[Tag][bb] = int(c)
|
||||
aa = aa + 1
|
||||
jahr = datetime.now().year
|
||||
tag = datetime.now().day
|
||||
monat = datetime.now().month
|
||||
ZahlenEuro[Tag]['Datum'] = f"{jahr}-{monat}-{tag}"
|
||||
Tag = 'Dienstag'
|
||||
for b in soup.find("p", string=lambda s: s and "dienstag" in s.lower()):
|
||||
ZahlenEuro[Tag]['Datum'] = b
|
||||
|
|
@ -91,10 +95,16 @@ def Euro():
|
|||
bb = 'Eurozahl' + str(aa)
|
||||
ZahlenEuro[Tag][bb] = int(i)
|
||||
aa = aa + 1
|
||||
jahr = datetime.now().year
|
||||
tag = datetime.now().day
|
||||
monat = datetime.now().month
|
||||
ZahlenEuro[Tag]['Datum'] = f"{jahr}-{monat}-{tag}"
|
||||
return ZahlenEuro
|
||||
def Normalziehung(a):
|
||||
wochentag = datetime.today().weekday()
|
||||
jahr = datetime.now().year
|
||||
tag = f"{datetime.now().day:02d}"
|
||||
monat = datetime.now().month
|
||||
|
||||
url = "https://www.ard-text.de/mobil/" + str(a)
|
||||
|
||||
|
|
@ -125,7 +135,7 @@ def Normalziehung(a):
|
|||
datum_woche = line.strip()
|
||||
break
|
||||
# Regex: Hauptzahlen finden (z. B. Zeile enthält "11 20 28 30 35 41")
|
||||
match_haupt = re.search(r"\s(\d{1,2}(?:\s+\d{1,2}){5})\s", text)
|
||||
match_haupt = re.search(r"\s(\d{1,2}(?:\s+\d{1,2}){6})\s", text)
|
||||
if match_haupt:
|
||||
lottozahlen = [int(n) for n in match_haupt.group(1).split()]
|
||||
|
||||
|
|
@ -163,7 +173,7 @@ def Normalziehung(a):
|
|||
ef = str((ab + str(cd)))
|
||||
Lottozahlen[ef] = i
|
||||
cd = cd + 1
|
||||
Lottozahlen['Datum'] = str(jahr) + ' / ' + str(datum_woche)
|
||||
Lottozahlen['Datum'] = f"{jahr}-{monat}-{tag}"
|
||||
Lottozahlen['Superzahl'] = superzahl
|
||||
Lottozahlen['Spiel77'] = int(game77)
|
||||
Lottozahlen['Super6'] = int(subber6)
|
||||
|
|
@ -184,12 +194,18 @@ def SQLnorm(data):
|
|||
"','" + 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)
|
||||
|
||||
notify_telegram(str(data))
|
||||
connection.commit()
|
||||
cursor.close()
|
||||
connection.close()
|
||||
|
||||
def SQLdienstag(data):
|
||||
connection = pymysql.connect(db="hubobel",
|
||||
user="hubobel",
|
||||
|
|
@ -206,6 +222,7 @@ def SQLdienstag(data):
|
|||
resp = cursor.execute(sql_q)
|
||||
if resp == 0:
|
||||
cursor.execute(sql)
|
||||
notify_telegram(str(data))
|
||||
#print(resp)
|
||||
connection.commit()
|
||||
cursor.close()
|
||||
|
|
@ -225,6 +242,7 @@ def SQLfreitag(data):
|
|||
resp = cursor.execute(sql_q)
|
||||
if resp == 0:
|
||||
cursor.execute(sql)
|
||||
notify_telegram(str(data))
|
||||
|
||||
connection.commit()
|
||||
cursor.close()
|
||||
|
|
@ -264,30 +282,55 @@ def SQLmittwoch(data):
|
|||
cursor.close()
|
||||
connection.close()
|
||||
|
||||
def datum():
|
||||
sql = """UPDATE `6aus49`
|
||||
SET datum = DATE_FORMAT(
|
||||
COALESCE(
|
||||
STR_TO_DATE(TRIM(SUBSTRING_INDEX(datum, '/', -1)), '%d.%m.%Y'),
|
||||
STR_TO_DATE(TRIM(SUBSTRING_INDEX(datum, '/', -1)), '%d.%m.%y')
|
||||
),
|
||||
'%Y-%m-%d'
|
||||
)
|
||||
WHERE
|
||||
COALESCE(
|
||||
STR_TO_DATE(TRIM(SUBSTRING_INDEX(datum, '/', -1)), '%d.%m.%Y'),
|
||||
STR_TO_DATE(TRIM(SUBSTRING_INDEX(datum, '/', -1)), '%d.%m.%y')
|
||||
) IS NOT NULL;"""
|
||||
connection = pymysql.connect(db="hubobel",
|
||||
user="hubobel",
|
||||
passwd="polier2003",
|
||||
host='10.0.1.123', charset='utf8')
|
||||
cursor = connection.cursor()
|
||||
cursor.execute(sql)
|
||||
connection.commit()
|
||||
cursor.close()
|
||||
connection.close()
|
||||
|
||||
|
||||
passw = conf()
|
||||
telegram_chat_id = passw['Telegram']['Chat_ID']
|
||||
telegram_token = passw['Telegram']['TOKEN']
|
||||
|
||||
wochentag = datetime.today().weekday()
|
||||
wochentag = 1
|
||||
wochentag = 5
|
||||
|
||||
if wochentag == 2:
|
||||
Zahl = Normalziehung(582)
|
||||
SQLnorm(Zahl)
|
||||
SQLmittwoch(Zahl)
|
||||
notify_telegram(str(Zahl))
|
||||
#notify_telegram(str(Zahl))
|
||||
elif wochentag == 5:
|
||||
Zahl = Normalziehung(581)
|
||||
SQLnorm(Zahl)
|
||||
SQLsamstag(Zahl)
|
||||
notify_telegram(str(Zahl))
|
||||
#notify_telegram(str(Zahl))
|
||||
elif wochentag == 1:
|
||||
Zahl = Euro()
|
||||
SQLdienstag(Zahl['Dienstag'])
|
||||
notify_telegram(str(Zahl['Dienstag']))
|
||||
#notify_telegram(str(Zahl['Dienstag']))
|
||||
elif wochentag == 4:
|
||||
Zahl = Euro()
|
||||
SQLfreitag(Zahl['Freitag'])
|
||||
notify_telegram(str(Zahl['Freitag']))
|
||||
#notify_telegram(str(Zahl['Freitag']))
|
||||
else:
|
||||
quit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue