aktueller Stand
This commit is contained in:
parent
d5457380f7
commit
9775f8991d
22 changed files with 692 additions and 216 deletions
2
.idea/HubobelsPython.iml
generated
2
.idea/HubobelsPython.iml
generated
|
|
@ -2,7 +2,7 @@
|
||||||
<module type="PYTHON_MODULE" version="4">
|
<module type="PYTHON_MODULE" version="4">
|
||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$" />
|
<content url="file://$MODULE_DIR$" />
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="jdk" jdkName="Python 3.6.1 (/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6)" jdkType="Python SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
<component name="TestRunnerService">
|
<component name="TestRunnerService">
|
||||||
|
|
|
||||||
11
.idea/dictionaries/hubobel.xml
generated
Normal file
11
.idea/dictionaries/hubobel.xml
generated
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
<component name="ProjectDictionaryState">
|
||||||
|
<dictionary name="hubobel">
|
||||||
|
<words>
|
||||||
|
<w>diese</w>
|
||||||
|
<w>farbe</w>
|
||||||
|
<w>fyeg</w>
|
||||||
|
<w>gibt</w>
|
||||||
|
<w>nicht</w>
|
||||||
|
</words>
|
||||||
|
</dictionary>
|
||||||
|
</component>
|
||||||
3
.idea/misc.xml
generated
3
.idea/misc.xml
generated
|
|
@ -1,4 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6.1 (/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6)" project-jdk-type="Python SDK" />
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6.1 (/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6)" project-jdk-type="Python SDK" />
|
||||||
|
<component name="PyCharmProfessionalAdvertiser">
|
||||||
|
<option name="shown" value="true" />
|
||||||
|
</component>
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
import datetime
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
import urllib2
|
import urllib2
|
||||||
|
#import scapy
|
||||||
|
|
||||||
# Constants
|
# Constants
|
||||||
timespan_threshhold = 3
|
timespan_threshhold = 3
|
||||||
|
|
|
||||||
13
Frank.py
Normal file
13
Frank.py
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
import base64
|
||||||
|
pool = {'cm90': 'MjAuMDAwMQ==', 'c2Nod2Fyeg==': 'MzAuMTIzNA==', 'Z29sZA==': 'NDAuMTIzNA=='}
|
||||||
|
while True:
|
||||||
|
antwort = input('Farbe:').lower()
|
||||||
|
code = (base64.b64encode(str.encode(antwort))).decode('utf-8')
|
||||||
|
if code in pool:
|
||||||
|
print(base64.b64decode((pool[code])).decode('utf-8'))
|
||||||
|
elif antwort[0] == '#':
|
||||||
|
print(base64.b64encode(str.encode(antwort[1:])).decode('utf-8'))
|
||||||
|
elif antwort == 'exit':
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
print('Diese Farbe gibt es nicht')
|
||||||
42
Hue.py
Normal file
42
Hue.py
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
from qhue import Bridge
|
||||||
|
import requests
|
||||||
|
import paho.mqtt.client as mqtt
|
||||||
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
client = mqtt.Client()
|
||||||
|
client.username_pw_set(username="hubobel",password="polier2003")
|
||||||
|
|
||||||
|
|
||||||
|
while True:
|
||||||
|
b = Bridge("10.0.1.19", "GxPN8lQmEvY5LXwtGRfKM5vwXegY9Yv10N0j2kxr")
|
||||||
|
url=b.url
|
||||||
|
response = requests.get(url)
|
||||||
|
data_response = response.json()
|
||||||
|
#print('Elemente in Bridge angemeldet: ',len(data_response))
|
||||||
|
|
||||||
|
for i in data_response['sensors']:
|
||||||
|
try:
|
||||||
|
if data_response['sensors'][i]['productname'] == 'Hue dimmer switch':
|
||||||
|
#print(data_response['sensors'][i])
|
||||||
|
|
||||||
|
states={'1002':True, '2002':'Dim up', '3002':'Dim down', '4002':False, '1000':True, '4000':False}
|
||||||
|
|
||||||
|
for a in states:
|
||||||
|
if str(a) == str(data_response['sensors'][i]['state']['buttonevent']):
|
||||||
|
#print(data_response['sensors'][i]['name'], ' buttonstate: ',states[a])
|
||||||
|
pfad="Test/"+data_response['sensors'][i]['name']
|
||||||
|
pfad=pfad.replace(' ','_')
|
||||||
|
#print(pfad)
|
||||||
|
try:
|
||||||
|
client.connect("10.0.1.59", 1884, 60)
|
||||||
|
client.publish(pfad, states[a])
|
||||||
|
print('puplished')
|
||||||
|
client.disconnect()
|
||||||
|
except:
|
||||||
|
print('error')
|
||||||
|
time.sleep(1)
|
||||||
|
except:
|
||||||
|
None
|
||||||
|
time.sleep(5)
|
||||||
|
#client.disconnect()
|
||||||
161
Lotto2SQL.py
161
Lotto2SQL.py
|
|
@ -1,7 +1,6 @@
|
||||||
import requests
|
|
||||||
import pymysql
|
import pymysql
|
||||||
import time
|
import bs4 as bs
|
||||||
|
import requests
|
||||||
|
|
||||||
connection = pymysql.connect(db="hubobel",
|
connection = pymysql.connect(db="hubobel",
|
||||||
user="hubobel",
|
user="hubobel",
|
||||||
|
|
@ -9,67 +8,141 @@ connection = pymysql.connect(db="hubobel",
|
||||||
host='10.0.1.59',charset='utf8')
|
host='10.0.1.59',charset='utf8')
|
||||||
cursor = connection.cursor()
|
cursor = connection.cursor()
|
||||||
|
|
||||||
wtag = time.strftime('%w')
|
#todo eurojackpot wieder fixen
|
||||||
|
|
||||||
if wtag == 3:
|
requests.packages.urllib3.disable_warnings()
|
||||||
try:
|
sauce = requests.get('https://www.eurojackpot.org/gewinnzahlen/', verify=False)
|
||||||
cursor.execute("""CREATE TABLE mittwoch (
|
soup = bs.BeautifulSoup(sauce.text, 'lxml')
|
||||||
datum Text, z1 INTEGER, z2 INTEGER, z3 INTEGER, z4 INTEGER, z5 INTEGER, z6 INTEGER, sz INTEGER, super6 INTEGER, spiel77 INTEGER)""")
|
|
||||||
except:
|
|
||||||
None
|
|
||||||
url_zitat = 'http://api.hubobel.de/lotto/Mittwoch'
|
|
||||||
resp_zitat = requests.get(url_zitat)
|
|
||||||
data_zitat = resp_zitat.json()
|
|
||||||
data=data_zitat[1]
|
|
||||||
sql = "INSERT INTO `mittwoch`(`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 mittwoch WHERE datum like '%" + data['Datum'] + "%'"
|
|
||||||
resp = cursor.execute(sql_q)
|
|
||||||
if resp == 0:
|
|
||||||
cursor.execute(sql)
|
|
||||||
connection.commit()
|
|
||||||
|
|
||||||
if wtag == 6:
|
ZahlenEuro = {'Datum': '', 'Z1': '', 'Z2': '', 'Z3': '', 'Z4': '', 'Z5': '', 'Eurozahl1': '', 'Eurozahl2': ''}
|
||||||
|
a = 1
|
||||||
|
datum = soup.find_all('li')
|
||||||
|
for i in datum:
|
||||||
|
i=str(i)
|
||||||
|
i = i.replace('<li>' , '').replace('</li>' , '').replace('<li class="extra">' , '')
|
||||||
|
if a <= 7:
|
||||||
|
if a<6:
|
||||||
|
ZahlenEuro['Z'+str(a)]=i
|
||||||
|
if a ==6:
|
||||||
|
ZahlenEuro['Eurozahl1']=i
|
||||||
|
if a ==7:
|
||||||
|
ZahlenEuro['Eurozahl2']=i
|
||||||
|
a +=1
|
||||||
|
|
||||||
|
sauce=(soup.find_all('div', class_ ='calendar'))
|
||||||
|
date=(soup.select_one('input[id=calendar]')['value'])
|
||||||
|
ZahlenEuro['Datum']=date
|
||||||
|
|
||||||
|
requests.packages.urllib3.disable_warnings()
|
||||||
|
sauce = requests.get('https://www.lotto24.de/webshop/product/lottonormal/result', verify=False)
|
||||||
|
soup = bs.BeautifulSoup(sauce.text, 'lxml')
|
||||||
|
|
||||||
|
# print(soup.prettify())
|
||||||
|
Lottozahlen = {'Datum': '', 'Z1': '', 'Z2': '', 'Z3': '', 'Z4': '', 'Z5': '', 'Z6': '', 'Superzahl': '',
|
||||||
|
'Spiel77': '', 'Super6': ''}
|
||||||
|
daten = soup.find_all('div', class_="winning-numbers__number")
|
||||||
|
zahlen = []
|
||||||
|
for i in daten:
|
||||||
|
zahlen.append(int(i.text))
|
||||||
|
a = 1
|
||||||
|
while a != 7:
|
||||||
|
Lottozahlen['Z' + str(a)] = zahlen[a - 1]
|
||||||
|
a = a + 1
|
||||||
|
Spiel77 = ''
|
||||||
|
Super6 = ''
|
||||||
|
zahlen77 = []
|
||||||
|
daten = soup.find_all('div', class_="winning-numbers__number--additional")
|
||||||
|
for i in daten:
|
||||||
|
zahlen77.append(int(i.text))
|
||||||
|
spiel77 = zahlen77[0:7]
|
||||||
|
super6 = zahlen77[-6:]
|
||||||
|
for i in spiel77:
|
||||||
|
Spiel77 = Spiel77 + str(i)
|
||||||
|
for i in super6:
|
||||||
|
Super6 = Super6 + str(i)
|
||||||
|
|
||||||
|
daten = soup.find_all('h2', class_="strong hidden-xs")
|
||||||
|
for i in daten:
|
||||||
|
date = i.text
|
||||||
|
date = date.replace(' ', '')
|
||||||
|
date = date.replace('\n', '')
|
||||||
|
|
||||||
|
start = (date.find('dem')) + 4
|
||||||
|
ende = (date.find('(Alle'))
|
||||||
|
|
||||||
|
Lottozahlen['Superzahl'] = zahlen[6]
|
||||||
|
Lottozahlen['Spiel77'] = Spiel77
|
||||||
|
Lottozahlen['Super6'] = Super6
|
||||||
|
Lottozahlen['Datum'] = date[start:ende]
|
||||||
|
|
||||||
|
#print(ZahlenEuro)
|
||||||
|
print(Lottozahlen)
|
||||||
|
print(date)
|
||||||
|
|
||||||
|
try:
|
||||||
|
cursor.execute("""CREATE TABLE euro (
|
||||||
|
datum Text, z1 INTEGER, z2 INTEGER, z3 INTEGER, z4 INTEGER, z5 INTEGER, sz1 INTEGER, sz2 INTEGER )""")
|
||||||
|
except:
|
||||||
|
None
|
||||||
|
data = ZahlenEuro
|
||||||
|
sql = "INSERT INTO `euro`(`datum`, `z1`, `z2`, `z3`, `z4`, `z5`, `sz1`, `sz2`) VALUES" \
|
||||||
|
" ('" + str(data['Datum']) + "','" + str(data['Z1']) + "','" + str(data['Z2']) + "','" + str(data['Z3']) + \
|
||||||
|
"','" + str(data['Z4']) + "','" + str(data['Z5']) + "','" + str(data['Eurozahl1']) + "','" + str(
|
||||||
|
data['Eurozahl2']) + "')"
|
||||||
|
sql_q = "SELECT * FROM euro WHERE datum like '%" + data['Datum'] + "%'"
|
||||||
|
resp = cursor.execute(sql_q)
|
||||||
|
if resp == 0:
|
||||||
|
cursor.execute(sql)
|
||||||
|
data=Lottozahlen
|
||||||
|
|
||||||
|
if "Samstag," in date:
|
||||||
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)""")
|
||||||
except:
|
except:
|
||||||
None
|
None
|
||||||
url_zitat = 'http://api.hubobel.de/lotto/Samstag'
|
|
||||||
resp_zitat = requests.get(url_zitat)
|
|
||||||
data_zitat = resp_zitat.json()
|
|
||||||
data=data_zitat[1]
|
|
||||||
sql = "INSERT INTO `samstag`(`datum`, `z1`, `z2`, `z3`, `z4`, `z5`, `z6`, `sz`, `super6`, `spiel77`) VALUES" \
|
sql = "INSERT INTO `samstag`(`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['Datum']) + "','" + str(data['Z1']) + "','" + str(data['Z2']) + "','" + str(data['Z3']) + \
|
||||||
"','"+str(data['Z4'])+"','"+str(data['Z5'])+"','"+str(data['Z6'])+"','"+str(data['Superzahl'])+\
|
"','" + str(data['Z4']) + "','" + str(data['Z5']) + "','" + str(data['Z6']) + "','" + str(data['Superzahl']) + \
|
||||||
"','"+str(data['Super6'])+"','"+str(data['Spiel77'])+"')"
|
"','" + str(data['Super6']) + "','" + str(data['Spiel77']) + "')"
|
||||||
sql_q = "SELECT * FROM samstag WHERE datum like '%" + data['Datum'] + "%'"
|
sql_q = "SELECT * FROM samstag WHERE datum like '%" + data['Datum'] + "%'"
|
||||||
resp = cursor.execute(sql_q)
|
resp = cursor.execute(sql_q)
|
||||||
if resp == 0:
|
if resp == 0:
|
||||||
cursor.execute(sql)
|
cursor.execute(sql)
|
||||||
connection.commit()
|
connection.commit()
|
||||||
|
|
||||||
if wtag == 5:
|
if "Mittwoch," in date:
|
||||||
try:
|
try:
|
||||||
cursor.execute("""CREATE TABLE euro (
|
cursor.execute("""CREATE TABLE mittwoch (
|
||||||
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, z6 INTEGER, sz INTEGER, super6 INTEGER, spiel77 INTEGER)""")
|
||||||
except:
|
except:
|
||||||
None
|
None
|
||||||
url_zitat = 'http://api.hubobel.de/lotto/Euro'
|
|
||||||
resp_zitat = requests.get(url_zitat)
|
sql = "INSERT INTO `mittwoch`(`datum`, `z1`, `z2`, `z3`, `z4`, `z5`, `z6`, `sz`, `super6`, `spiel77`) VALUES" \
|
||||||
data_zitat = resp_zitat.json()
|
" ('" + str(data['Datum']) + "','" + str(data['Z1']) + "','" + str(data['Z2']) + "','" + str(data['Z3']) + \
|
||||||
data=data_zitat[1]
|
"','" + str(data['Z4']) + "','" + str(data['Z5']) + "','" + str(data['Z6']) + "','" + str(data['Superzahl']) + \
|
||||||
sql = "INSERT INTO `euro`(`datum`, `z1`, `z2`, `z3`, `z4`, `z5`, `sz1`, `sz2`) VALUES" \
|
"','" + str(data['Super6']) + "','" + str(data['Spiel77']) + "')"
|
||||||
" ('"+str(data['Datum'])+"','"+str(data['Z1'])+"','"+str(data['Z2'])+"','"+str(data['Z3'])+\
|
sql_q = "SELECT * FROM mittwoch WHERE datum like '%" + data['Datum'] + "%'"
|
||||||
"','"+str(data['Z4'])+"','"+str(data['Z5'])+"','"+str(data['Superzahl1'])+"','"+str(data['Superzahl2'])+"')"
|
|
||||||
sql_q = "SELECT * FROM euro WHERE datum like '%" + data['Datum'] + "%'"
|
|
||||||
resp = cursor.execute(sql_q)
|
resp = cursor.execute(sql_q)
|
||||||
if resp == 0:
|
if resp == 0:
|
||||||
cursor.execute(sql)
|
cursor.execute(sql)
|
||||||
|
|
||||||
connection.commit()
|
connection.commit()
|
||||||
|
|
||||||
|
try:
|
||||||
|
cursor.execute("""CREATE TABLE 6aus49 (
|
||||||
|
datum Text, z1 INTEGER, z2 INTEGER, z3 INTEGER, z4 INTEGER, z5 INTEGER, z6 INTEGER, sz INTEGER, super6 INTEGER, spiel77 INTEGER)""")
|
||||||
|
except:
|
||||||
|
None
|
||||||
|
|
||||||
|
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()
|
cursor.close()
|
||||||
connection.close()
|
connection.close()
|
||||||
9
Pulsecounter.py
Normal file
9
Pulsecounter.py
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
import requests
|
||||||
|
|
||||||
|
url = 'http://10.0.1.103/?json:'
|
||||||
|
response = requests.get(url)
|
||||||
|
data_response = response.json()
|
||||||
|
a=[1,2,3,4,5,6]
|
||||||
|
for i in a:
|
||||||
|
print(data_response['vars'][i]['value'], data_response['vars'][i]['unit'])
|
||||||
|
|
||||||
347
REST_APIv2.py
347
REST_APIv2.py
|
|
@ -1,92 +1,12 @@
|
||||||
import random
|
import random
|
||||||
from flask import Flask, jsonify,make_response
|
from flask import Flask, jsonify,make_response
|
||||||
|
from flask import request
|
||||||
import pymysql
|
import pymysql
|
||||||
import bs4 as bs
|
import bs4 as bs
|
||||||
import urllib.request
|
import requests as req
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
def Lotto():
|
|
||||||
sauce = urllib.request.urlopen('http://www.lottotip-check.de').read()
|
|
||||||
soup = bs.BeautifulSoup(sauce, 'html.parser')
|
|
||||||
|
|
||||||
# print(soup.prettify())
|
|
||||||
table = soup.find_all('table')
|
|
||||||
row = []
|
|
||||||
ZahlenAll = []
|
|
||||||
ZahlenMittwoch = {'Datum': '', 'Z1': '', 'Z2': '', 'Z3': '', 'Z4': '', 'Z5': '', 'Z6': '', 'Superzahl': '',
|
|
||||||
'Spiel77': '', 'Super6': ''}
|
|
||||||
ZahlenSamstag = {'Datum': '', 'Z1': '', 'Z2': '', 'Z3': '', 'Z4': '', 'Z5': '', 'Z6': '', 'Superzahl': '',
|
|
||||||
'Spiel77': '', 'Super6': ''}
|
|
||||||
ZahlenEuro = {'Datum': '', 'Z1': '', 'Z2': '', 'Z3': '', 'Z4': '', 'Z5': '', 'Superzahl1': '', 'Superzahl2': ''}
|
|
||||||
for i in table:
|
|
||||||
table_rows = i.find_all('tr')
|
|
||||||
for tr in table_rows:
|
|
||||||
# print(tr)
|
|
||||||
td = tr.find_all('td')
|
|
||||||
if td != []:
|
|
||||||
row = [i.text for i in td]
|
|
||||||
# print(row)
|
|
||||||
th = tr.find_all('th')
|
|
||||||
sz = [i.text for i in th]
|
|
||||||
# print(len(sz))
|
|
||||||
if len(sz) == 5:
|
|
||||||
row.append(str(sz[2]))
|
|
||||||
row.append(str(sz[3]))
|
|
||||||
date = 'Ziehung vom: ' + str(sz[0])
|
|
||||||
sz = str(sz[1])
|
|
||||||
row.append(sz)
|
|
||||||
row.insert(0, date)
|
|
||||||
ZahlenAll.extend(row)
|
|
||||||
a = 0
|
|
||||||
while a <= 5:
|
|
||||||
a = a + 1
|
|
||||||
ZahlenMittwoch['Z' + str(a)] = int(ZahlenAll[a])
|
|
||||||
ZahlenMittwoch['Datum'] = ZahlenAll[0]
|
|
||||||
ZahlenMittwoch['Superzahl'] = int(ZahlenAll[9])
|
|
||||||
ZahlenMittwoch['Super6'] = int(ZahlenAll[8])
|
|
||||||
ZahlenMittwoch['Spiel77'] = int(ZahlenAll[7])
|
|
||||||
print(ZahlenMittwoch)
|
|
||||||
a = 0
|
|
||||||
while a <= 5:
|
|
||||||
a = a + 1
|
|
||||||
ZahlenSamstag['Z' + str(a)] = int(ZahlenAll[a + 18])
|
|
||||||
ZahlenSamstag['Datum'] = ZahlenAll[18]
|
|
||||||
ZahlenSamstag['Superzahl'] = int(ZahlenAll[27])
|
|
||||||
ZahlenSamstag['Super6'] = int(ZahlenAll[26])
|
|
||||||
ZahlenSamstag['Spiel77'] = int(ZahlenAll[25])
|
|
||||||
print(ZahlenSamstag)
|
|
||||||
|
|
||||||
a = 0
|
|
||||||
while a <= 4:
|
|
||||||
a = a + 1
|
|
||||||
ZahlenEuro['Z' + str(a)] = int(ZahlenAll[a + 10])
|
|
||||||
ZahlenEuro['Datum'] = ZahlenAll[10]
|
|
||||||
ZahlenEuro['Superzahl2'] = int(ZahlenAll[17])
|
|
||||||
ZahlenEuro['Superzahl1'] = int(ZahlenAll[16])
|
|
||||||
print(ZahlenEuro)
|
|
||||||
return ZahlenMittwoch,ZahlenEuro,ZahlenSamstag
|
|
||||||
|
|
||||||
@app.route('/lotto', methods=['GET'])
|
|
||||||
def get_lotto():
|
|
||||||
Mit,EUR,Sam=Lotto()
|
|
||||||
return jsonify('alle Angaben ohne Gewaehr:',Mit,EUR,Sam)
|
|
||||||
|
|
||||||
@app.route('/lotto/Samstag', methods=['GET'])
|
|
||||||
def get_lottoSam():
|
|
||||||
Mit,EUR,Sam=Lotto()
|
|
||||||
return jsonify('alle Angaben ohne Gewaehr:',Sam)
|
|
||||||
|
|
||||||
@app.route('/lotto/Mittwoch', methods=['GET'])
|
|
||||||
def get_lottoMit():
|
|
||||||
Mit,EUR,Sam=Lotto()
|
|
||||||
return jsonify('alle Angaben ohne Gewaehr:',Mit)
|
|
||||||
|
|
||||||
@app.route('/lotto/Euro', methods=['GET'])
|
|
||||||
def get_lottoEur():
|
|
||||||
Mit,EUR,Sam=Lotto()
|
|
||||||
return jsonify('alle Angaben ohne Gewaehr:',EUR)
|
|
||||||
|
|
||||||
def Update():
|
def Update():
|
||||||
connection = pymysql.connect(db="hubobel",
|
connection = pymysql.connect(db="hubobel",
|
||||||
user="hubobel",
|
user="hubobel",
|
||||||
|
|
@ -101,22 +21,204 @@ def Update():
|
||||||
connection.close()
|
connection.close()
|
||||||
a=len(fact)
|
a=len(fact)
|
||||||
return fact,a
|
return fact,a
|
||||||
|
def Lotto():
|
||||||
|
|
||||||
|
connection = pymysql.connect(db="hubobel",
|
||||||
|
user="hubobel",
|
||||||
|
passwd="polier2003",
|
||||||
|
host='10.0.1.59', charset='utf8')
|
||||||
|
cursor = connection.cursor()
|
||||||
|
sql = "SELECT * FROM mittwoch ORDER BY id DESC"
|
||||||
|
resp = cursor.execute(sql)
|
||||||
|
x = int(resp)
|
||||||
|
sql_q = "SELECT * FROM mittwoch WHERE id like '" + str(x) + "'"
|
||||||
|
cursor.execute(sql_q)
|
||||||
|
resp = cursor.fetchall()
|
||||||
|
resp = (resp[0][1:])
|
||||||
|
ZahlenMittwoch = {'Datum': '', 'Z1': '', 'Z2': '', 'Z3': '', 'Z4': '', 'Z5': '', 'Z6': '', 'Superzahl': '',
|
||||||
|
'Spiel77': '', 'Super6': ''}
|
||||||
|
a = 1
|
||||||
|
while a != 7:
|
||||||
|
ZahlenMittwoch['Z' + str(a)] = resp[a]
|
||||||
|
a = a + 1
|
||||||
|
ZahlenMittwoch['Datum'] = resp[0]
|
||||||
|
ZahlenMittwoch['Superzahl'] = resp[7]
|
||||||
|
ZahlenMittwoch['Spiel77'] = resp[9]
|
||||||
|
ZahlenMittwoch['Super6'] = resp[8]
|
||||||
|
|
||||||
|
cursor = connection.cursor()
|
||||||
|
sql = "SELECT * FROM samstag ORDER BY id DESC"
|
||||||
|
resp = cursor.execute(sql)
|
||||||
|
x = int(resp)
|
||||||
|
sql_q = "SELECT * FROM samstag WHERE id like '" + str(x) + "'"
|
||||||
|
cursor.execute(sql_q)
|
||||||
|
resp = cursor.fetchall()
|
||||||
|
resp = resp[0][1:]
|
||||||
|
ZahlenSamstag = {'Datum': '', 'Z1': '', 'Z2': '', 'Z3': '', 'Z4': '', 'Z5': '', 'Z6': '', 'Superzahl': '',
|
||||||
|
'Spiel77': '', 'Super6': ''}
|
||||||
|
a = 1
|
||||||
|
while a != 7:
|
||||||
|
ZahlenSamstag['Z' + str(a)] = resp[a]
|
||||||
|
a = a + 1
|
||||||
|
ZahlenSamstag['Datum'] = resp[0]
|
||||||
|
ZahlenSamstag['Superzahl'] = resp[7]
|
||||||
|
ZahlenSamstag['Spiel77'] = resp[9]
|
||||||
|
ZahlenSamstag['Super6'] = resp[8]
|
||||||
|
|
||||||
|
cursor = connection.cursor()
|
||||||
|
sql = "SELECT * FROM euro ORDER BY id DESC"
|
||||||
|
resp = cursor.execute(sql)
|
||||||
|
x = int(resp)
|
||||||
|
sql_q = "SELECT * FROM euro WHERE id like '" + str(x) + "'"
|
||||||
|
cursor.execute(sql_q)
|
||||||
|
resp = cursor.fetchall()
|
||||||
|
resp = resp[0][1:]
|
||||||
|
ZahlenEuro = {'Datum': '', 'Z1': '', 'Z2': '', 'Z3': '', 'Z4': '', 'Z5': '', 'Eurozahl1': '', 'Eurozahl2': ''}
|
||||||
|
a = 1
|
||||||
|
while a != 6:
|
||||||
|
ZahlenEuro['Z' + str(a)] = resp[a]
|
||||||
|
a = a + 1
|
||||||
|
ZahlenEuro['Datum'] = resp[0]
|
||||||
|
ZahlenEuro['Eurozahl1'] = resp[6]
|
||||||
|
ZahlenEuro['Eurozahl2'] = resp[7]
|
||||||
|
connection.commit()
|
||||||
|
cursor.close()
|
||||||
|
connection.close()
|
||||||
|
return ZahlenMittwoch,ZahlenEuro,ZahlenSamstag
|
||||||
|
def Lottoaktuell():
|
||||||
|
req.packages.urllib3.disable_warnings()
|
||||||
|
sauce = req.get('https://www.eurojackpot.org/gewinnzahlen/', verify=False)
|
||||||
|
soup = bs.BeautifulSoup(sauce.text, 'lxml')
|
||||||
|
|
||||||
|
zahlen = []
|
||||||
|
ergebniss = []
|
||||||
|
ZahlenEuro = {'Datum': '', 'Z1': '', 'Z2': '', 'Z3': '', 'Z4': '', 'Z5': '', 'Eurozahl1': '', 'Eurozahl2': ''}
|
||||||
|
a = 1
|
||||||
|
datum = soup.find_all('time')
|
||||||
|
tag = []
|
||||||
|
for i in datum:
|
||||||
|
tag.append(i.text)
|
||||||
|
for li in soup.find_all('li'):
|
||||||
|
zahlen.append(li.text)
|
||||||
|
for i in zahlen[0:7]:
|
||||||
|
ergebniss.append(int(i))
|
||||||
|
ergebniss.append(tag[1])
|
||||||
|
while a != 6:
|
||||||
|
ZahlenEuro['Z' + str(a)] = ergebniss[a - 1]
|
||||||
|
a = a + 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ende = (ergebniss[7].find('- Freitag'))
|
||||||
|
Datum=ergebniss[7]
|
||||||
|
ZahlenEuro['Datum'] = Datum[:ende-1]
|
||||||
|
ZahlenEuro['Eurozahl1'] = ergebniss[5]
|
||||||
|
ZahlenEuro['Eurozahl2'] = ergebniss[6]
|
||||||
|
|
||||||
|
req.packages.urllib3.disable_warnings()
|
||||||
|
sauce = req.get('https://www.lotto24.de/webshop/product/lottonormal/result', verify=False)
|
||||||
|
soup = bs.BeautifulSoup(sauce.text, 'lxml')
|
||||||
|
|
||||||
|
# print(soup.prettify())
|
||||||
|
Lottozahlen = {'Datum': '', 'Z1': '', 'Z2': '', 'Z3': '', 'Z4': '', 'Z5': '', 'Z6': '', 'Superzahl': '',
|
||||||
|
'Spiel77': '', 'Super6': ''}
|
||||||
|
daten = soup.find_all('div', class_="winning-numbers__number")
|
||||||
|
zahlen = []
|
||||||
|
for i in daten:
|
||||||
|
zahlen.append(int(i.text))
|
||||||
|
a = 1
|
||||||
|
while a != 7:
|
||||||
|
Lottozahlen['Z' + str(a)] = zahlen[a - 1]
|
||||||
|
a = a + 1
|
||||||
|
Spiel77 = ''
|
||||||
|
Super6 = ''
|
||||||
|
zahlen77 = []
|
||||||
|
daten = soup.find_all('div', class_="winning-numbers__number--additional")
|
||||||
|
for i in daten:
|
||||||
|
zahlen77.append(int(i.text))
|
||||||
|
spiel77 = zahlen77[0:7]
|
||||||
|
super6 = zahlen77[-6:]
|
||||||
|
for i in spiel77:
|
||||||
|
Spiel77 = Spiel77 + str(i)
|
||||||
|
for i in super6:
|
||||||
|
Super6 = Super6 + str(i)
|
||||||
|
|
||||||
|
daten = soup.find_all('h2', class_="strong hidden-xs")
|
||||||
|
for i in daten:
|
||||||
|
date = i.text
|
||||||
|
date = date.replace(' ', '')
|
||||||
|
date = date.replace('\n', '')
|
||||||
|
|
||||||
|
start = (date.find('dem')) + 4
|
||||||
|
ende = (date.find('(Alle'))
|
||||||
|
|
||||||
|
Lottozahlen['Superzahl'] = zahlen[6]
|
||||||
|
Lottozahlen['Spiel77'] = Spiel77
|
||||||
|
Lottozahlen['Super6'] = Super6
|
||||||
|
Lottozahlen['Datum'] = date[start:ende]
|
||||||
|
|
||||||
|
return Lottozahlen,ZahlenEuro
|
||||||
|
|
||||||
|
@app.route('/lotto', methods=['GET'])
|
||||||
|
def get_lotto():
|
||||||
|
Mit,EUR,Sam=Lotto()
|
||||||
|
return jsonify('Hinweis: Alle Angaben ohne Gewaehr auf Richtigkeit:',Mit,EUR,Sam)
|
||||||
|
|
||||||
|
@app.route('/lotto/Samstag', methods=['GET'])
|
||||||
|
def get_lottoSam():
|
||||||
|
Mit,EUR,Sam=Lotto()
|
||||||
|
return jsonify('Hinweis: Alle Angaben ohne Gewaehr auf Richtigkeit:',Sam)
|
||||||
|
|
||||||
|
@app.route('/lotto/Mittwoch', methods=['GET'])
|
||||||
|
def get_lottoMit():
|
||||||
|
Mit,EUR,Sam=Lotto()
|
||||||
|
return jsonify('Hinweis: Alle Angaben ohne Gewaehr auf Richtigkeit:',Mit)
|
||||||
|
|
||||||
|
@app.route('/lotto/Euro', methods=['GET'])
|
||||||
|
def get_lottoEur():
|
||||||
|
Mit,EUR,Sam=Lotto()
|
||||||
|
return jsonify('Hinweis: Alle Angaben ohne Gewaehr auf Richtigkeit:',EUR)
|
||||||
|
|
||||||
|
@app.route('/lotto/aktuell', methods=['GET'])
|
||||||
|
def get_lottoAktuell():
|
||||||
|
Lottozahlen,ZahlenEuro=Lottoaktuell()
|
||||||
|
|
||||||
|
return jsonify(Lottozahlen,ZahlenEuro)
|
||||||
|
|
||||||
@app.errorhandler(404)
|
@app.errorhandler(404)
|
||||||
def not_found(error):
|
def not_found(error):
|
||||||
return make_response(jsonify({'error': 'Nicht unterstuetzt'}), 404)
|
return make_response(jsonify({'error': 'Nicht unterstuetzt'}), 404)
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def index():
|
def index():
|
||||||
fact,a = Update()
|
fact,a = Update()
|
||||||
fact={
|
|
||||||
'GET:api.hubobel.de/facts.....':'Uebersicht ueber alle verfuegbaren Facts mit ihrer ID',
|
return """
|
||||||
'GET: api.hubobel.de/facts/<ID>.....':'JSON des abgefragten Facts',
|
<!DOCTYPE html>
|
||||||
'GET: api.hubobel.de/facts/zufall.....':'ein zufaellig ausgewaehlter Fact wird im JSON zurueck gegeben',
|
<head>
|
||||||
'facts':a,
|
<title>Hubobel.de RESTful-API</title>
|
||||||
'GET: api.hubobel.de/lotto....':'Liefert die letzten Zahlen von Mittwochs-, Euro- und Samstagslotto',
|
<link rel="stylesheet" href="http://stash.compjour.org/assets/css/foundation.css">
|
||||||
'GET: api.hubobel.de/lotto/Mittwoch.....':'Liefert die letzten Mottwochszahlen',
|
</head>
|
||||||
'GET: api.hubobel.de/lotto/Euro.....':'Liefert die letzten Eurojackpotzahlen',
|
<body style="width: 880px; margin: auto;">
|
||||||
'GET: api.hubobel.de/lotto/Samstag.....':'Liefert die letzten Samstagszahlen'}
|
<h1>Willkommen bei der RESTful-API von hubobel.de</h1>
|
||||||
return jsonify({'eine REST-API von hubobel.de Methoden/Funktionen':fact})
|
<p>folgende Aufrufe sind derzeit realisisert:</p>
|
||||||
|
<p>GET: api.hubobel.de/facts.....: Uebersicht ueber alle verfuegbaren Facts mit ihrer ID</p>
|
||||||
|
<p>GET: api.hubobel.de/facts/'ID'.....: JSON des abgefragten Facts</p>
|
||||||
|
<p>GET: api.hubobel.de/facts/zufall.....: ein zufaellig ausgewaehlter Fact wird im JSON zurueck gegeben</p>
|
||||||
|
<p>GET: api.hubobel.de/lotto....: Liefert die letzten Zahlen von Mittwochs-, Euro- und Samstagslotto
|
||||||
|
(aus der Datenbank)</p>
|
||||||
|
<p>GET: api.hubobel.de/lotto/Mittwoch.....: Liefert die letzten Mottwochszahlen (aus der Datenbank)</p>
|
||||||
|
<p>GET: api.hubobel.de/lotto/Euro.....: Liefert die letzten Eurojackpotzahlen (aus der Datenbank)</p>
|
||||||
|
<p>GET: api.hubobel.de/lotto/Samstag.....: Liefert die letzten Samstagszahlen (aus der Datenbank)</p>
|
||||||
|
<p>GET: api.hubobel.de/lotto/aktuell.....: Liefert die letzten Lottozahlen des Euro- und Mittwoch
|
||||||
|
bzw.Samstagslotto (online jeweils neu ermittelt)</p>
|
||||||
|
<p>POST: api.hubobel.de/lotto/6aus49/check.....: Uebergabe der 6+1 Zahlen als Liste - liefert Anzahl
|
||||||
|
der Treffer zurueck</p>
|
||||||
|
<p>POST: api.hubobel.de/lotto/6aus49/check.....: Uebergabe der 5+2 Zahlen als Liste - liefert Anzahl
|
||||||
|
der Treffer zurueck</p>
|
||||||
|
<p>...to be continued</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
"""
|
||||||
@app.route('/facts', methods=['GET'])
|
@app.route('/facts', methods=['GET'])
|
||||||
def get_tasks():
|
def get_tasks():
|
||||||
fact, a = Update()
|
fact, a = Update()
|
||||||
|
|
@ -159,5 +261,64 @@ def zufall():
|
||||||
cursor.close()
|
cursor.close()
|
||||||
connection.close()
|
connection.close()
|
||||||
return jsonify({ran: resp})
|
return jsonify({ran: resp})
|
||||||
|
|
||||||
|
@app.route('/lotto/6aus49/check', methods=['POST'])
|
||||||
|
def checkMittwoch():
|
||||||
|
if len(request.json) != 7:
|
||||||
|
return make_response(jsonify({'error': 'Sie müssen 6+1 Zahl als Liste übergeben'}), 404)
|
||||||
|
Treffer=0
|
||||||
|
Ziffern=[]
|
||||||
|
eingabe=request.json
|
||||||
|
Lottozahlen_aktuell,ZahlenEuro_aktuell=Lottoaktuell()
|
||||||
|
|
||||||
|
Lottozahlen=[]
|
||||||
|
a=1
|
||||||
|
while a!=7:
|
||||||
|
Lottozahlen.append(Lottozahlen_aktuell['Z'+str(a)])
|
||||||
|
a+=1
|
||||||
|
for i in eingabe[:6]:
|
||||||
|
if i in Lottozahlen:
|
||||||
|
Treffer+=1
|
||||||
|
Ziffern.append(i)
|
||||||
|
Lottozahlen.remove(i)
|
||||||
|
if eingabe[6]==Lottozahlen_aktuell['Superzahl']:
|
||||||
|
Superzahl=True
|
||||||
|
else:
|
||||||
|
Superzahl=False
|
||||||
|
|
||||||
|
return jsonify({'Treffer':Treffer,'Superzahl':Superzahl,'richtige Ziffern':Ziffern})
|
||||||
|
|
||||||
|
@app.route('/lotto/Euro/check', methods=['POST'])
|
||||||
|
def checkEuro():
|
||||||
|
if len(request.json) != 7:
|
||||||
|
return make_response(jsonify({'error': 'Sie müssen 5+2 Zahlen als Liste übergeben'}), 404)
|
||||||
|
Treffer=0
|
||||||
|
Ziffern=[]
|
||||||
|
eingabe=request.json
|
||||||
|
Lottozahlen_aktuell,ZahlenEuro_aktuell=Lottoaktuell()
|
||||||
|
|
||||||
|
Lottozahlen=[]
|
||||||
|
a=1
|
||||||
|
while a!=6:
|
||||||
|
Lottozahlen.append(ZahlenEuro_aktuell['Z'+str(a)])
|
||||||
|
a+=1
|
||||||
|
for i in eingabe[:6]:
|
||||||
|
if i in Lottozahlen:
|
||||||
|
Treffer+=1
|
||||||
|
Ziffern.append(i)
|
||||||
|
Lottozahlen.remove(i)
|
||||||
|
if eingabe[5]==ZahlenEuro_aktuell['Eurozahl1']:
|
||||||
|
Eurozahl1=True
|
||||||
|
else:
|
||||||
|
Eurozahl1=False
|
||||||
|
if eingabe[6]==ZahlenEuro_aktuell['Eurozahl2']:
|
||||||
|
Eurozahl2=True
|
||||||
|
else:
|
||||||
|
Eurozahl2=False
|
||||||
|
|
||||||
|
return jsonify({'Treffer':Treffer,'Eurozahl1':Eurozahl1,'Eurozahl2':Eurozahl2,'richtige Ziffern':Ziffern})
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(host='0.0.0.0')
|
app.run(host='0.0.0.0')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
22
SQL.py
22
SQL.py
|
|
@ -11,21 +11,7 @@ try:
|
||||||
except:
|
except:
|
||||||
print ('weiter')
|
print ('weiter')
|
||||||
|
|
||||||
sql="SELECT * FROM facts ORDER BY nr DESC"
|
sql = "SELECT * FROM facts ORDER BY nr DESC"
|
||||||
resp=cursor.execute(sql)
|
resp = cursor.execute(sql)
|
||||||
x=int(resp)+1
|
|
||||||
updatecount=0
|
print(resp)
|
||||||
with open('api/chuck.txt', 'r') as fp:
|
|
||||||
for line in fp:
|
|
||||||
line=line.replace('\n','')
|
|
||||||
sql = "INSERT INTO `facts`(`nr`, `fact`) VALUES ('"+str(x)+"','"+line+"')"
|
|
||||||
sql_q = "SELECT * FROM facts WHERE fact like '%" + line + "%'"
|
|
||||||
resp = cursor.execute(sql_q)
|
|
||||||
if resp == 0:
|
|
||||||
cursor.execute(sql)
|
|
||||||
x=x+1
|
|
||||||
updatecount=updatecount+1
|
|
||||||
connection.commit()
|
|
||||||
cursor.close()
|
|
||||||
connection.close()
|
|
||||||
print('Es wurden '+str(updatecount)+' neue Einträge der Datenbank hinzugefügt.')
|
|
||||||
10
Snapshot.py
Normal file
10
Snapshot.py
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
import urllib.request
|
||||||
|
import telebot
|
||||||
|
|
||||||
|
urllib.request.urlretrieve('http://10.0.1.59:8765/picture/1/current/', 'snap.jpg')
|
||||||
|
|
||||||
|
TOKEN='680737840:AAEaa7Vxl_kZz_LWS1_S-lH6Eda7HXqu6Y4'
|
||||||
|
ChatID='322673713'
|
||||||
|
tb = telebot.TeleBot(TOKEN)
|
||||||
|
document=open('snap.jpg','rb')
|
||||||
|
tb.send_photo(ChatID,document)
|
||||||
|
|
@ -26,6 +26,7 @@ PASSWORD = "PL19zPL19z"
|
||||||
TOKEN='312534798:AAFbMjS-tfd2BiZ_j3NEZuQYKwzACMcioVo'
|
TOKEN='312534798:AAFbMjS-tfd2BiZ_j3NEZuQYKwzACMcioVo'
|
||||||
Chat_ID='322673713'
|
Chat_ID='322673713'
|
||||||
SAVEDIR = "/home/carsten"
|
SAVEDIR = "/home/carsten"
|
||||||
|
SAVEDIR = ""
|
||||||
|
|
||||||
if telegram:
|
if telegram:
|
||||||
tb = telebot.TeleBot(TOKEN)
|
tb = telebot.TeleBot(TOKEN)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python
|
mv#!/usr/bin/env python
|
||||||
|
|
||||||
import poplib
|
import poplib
|
||||||
import email
|
import email
|
||||||
|
|
|
||||||
7
kino_wrapper.py
Normal file
7
kino_wrapper.py
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
import bs4 as bs
|
||||||
|
import requests
|
||||||
|
import time
|
||||||
|
|
||||||
|
requests.packages.urllib3.disable_warnings()
|
||||||
|
sauce=requests.get('https://www.eurojackpot.org/gewinnzahlen/',verify=False)
|
||||||
|
soup = bs.BeautifulSoup(sauce.text,'lxml')
|
||||||
17
kodi_db.py
Normal file
17
kodi_db.py
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
#Filmdatenbank abfragen
|
||||||
|
import pymysql
|
||||||
|
connection = pymysql.connect(db="MyVideos107",
|
||||||
|
user="hubobel",
|
||||||
|
passwd="polier2003",
|
||||||
|
host='10.0.1.59', charset='utf8')
|
||||||
|
cursor = connection.cursor()
|
||||||
|
sql = "SELECT * FROM tvshow_view ORDER BY c00 DESC"
|
||||||
|
resp = cursor.execute(sql)
|
||||||
|
x = cursor.fetchall()
|
||||||
|
a=1
|
||||||
|
antwort={}
|
||||||
|
for i in x:
|
||||||
|
print(i[1]+str(i[33]))
|
||||||
|
antwort[a] = i[1]
|
||||||
|
a = a + 1
|
||||||
|
print (antwort)
|
||||||
70
lotto24.py
Normal file
70
lotto24.py
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
import bs4 as bs
|
||||||
|
import requests
|
||||||
|
import time
|
||||||
|
|
||||||
|
requests.packages.urllib3.disable_warnings()
|
||||||
|
sauce=requests.get('https://www.eurojackpot.org/gewinnzahlen/',verify=False)
|
||||||
|
soup = bs.BeautifulSoup(sauce.text,'lxml')
|
||||||
|
|
||||||
|
print(soup)
|
||||||
|
zahlen=[]
|
||||||
|
ergebniss=[]
|
||||||
|
ZahlenEuro = {'Datum': '', 'Z1': '', 'Z2': '', 'Z3': '', 'Z4': '', 'Z5': '', 'Eurozahl1': '', 'Eurozahl2': ''}
|
||||||
|
a=1
|
||||||
|
datum= soup.find_all('div')
|
||||||
|
print(datum)
|
||||||
|
tag=[]
|
||||||
|
for i in datum:
|
||||||
|
tag.append(i.text)
|
||||||
|
for li in soup.find_all('li'):
|
||||||
|
zahlen.append(li.text)
|
||||||
|
for i in zahlen[0:7]:
|
||||||
|
ergebniss.append(int(i))
|
||||||
|
ergebniss.append(tag[1])
|
||||||
|
while a!=6:
|
||||||
|
ZahlenEuro['Z'+str(a)]=ergebniss[a-1]
|
||||||
|
a=a+1
|
||||||
|
ZahlenEuro['Datum']=ergebniss[7]
|
||||||
|
ZahlenEuro['Eurozahl1']=ergebniss[5]
|
||||||
|
ZahlenEuro['Eurozahl2']=ergebniss[6]
|
||||||
|
|
||||||
|
requests.packages.urllib3.disable_warnings()
|
||||||
|
sauce=requests.get('https://www.lotto24.de/webshop/product/lottonormal/result',verify=False)
|
||||||
|
soup = bs.BeautifulSoup(sauce.text,'lxml')
|
||||||
|
|
||||||
|
#print(soup.prettify())
|
||||||
|
Lottozahlen = {'Datum': '', 'Z1': '', 'Z2': '', 'Z3': '', 'Z4': '', 'Z5': '', 'Z6': '', 'Superzahl': '',
|
||||||
|
'Spiel77': '', 'Super6': ''}
|
||||||
|
daten=soup.find_all('div',class_="winning-numbers__number")
|
||||||
|
zahlen=[]
|
||||||
|
for i in daten:
|
||||||
|
zahlen.append(int(i.text))
|
||||||
|
a=1
|
||||||
|
while a!=7:
|
||||||
|
Lottozahlen['Z'+str(a)]=zahlen[a-1]
|
||||||
|
a=a+1
|
||||||
|
Spiel77=''
|
||||||
|
Super6=''
|
||||||
|
zahlen77=[]
|
||||||
|
daten=soup.find_all('div',class_="winning-numbers__number--additional")
|
||||||
|
for i in daten:
|
||||||
|
zahlen77.append(int(i.text))
|
||||||
|
spiel77=zahlen77[0:7]
|
||||||
|
super6=zahlen77[-6:]
|
||||||
|
for i in spiel77:
|
||||||
|
Spiel77=Spiel77+str(i)
|
||||||
|
for i in super6:
|
||||||
|
Super6=Super6+str(i)
|
||||||
|
|
||||||
|
daten=soup.find_all('h2',class_="strong hidden-xs")
|
||||||
|
for i in daten:
|
||||||
|
date=i.text
|
||||||
|
date=date.replace(' ','')
|
||||||
|
date = date.replace('\n', '')
|
||||||
|
|
||||||
|
Lottozahlen['Superzahl']=zahlen[6]
|
||||||
|
Lottozahlen['Spiel77']=Spiel77
|
||||||
|
Lottozahlen['Super6']=Super6
|
||||||
|
Lottozahlen['Datum']=date
|
||||||
|
print(Lottozahlen)
|
||||||
|
print(ZahlenEuro)
|
||||||
BIN
mpg/heute.pdf
BIN
mpg/heute.pdf
Binary file not shown.
|
|
@ -122,11 +122,14 @@ def Chuckfact():
|
||||||
fact=(data_zitat[i])
|
fact=(data_zitat[i])
|
||||||
return fact
|
return fact
|
||||||
def Lotto():
|
def Lotto():
|
||||||
|
global lottoa,lottob
|
||||||
a = (sorted(random.sample(range(1, 49), 6)))
|
a = (sorted(random.sample(range(1, 49), 6)))
|
||||||
b = random.randrange(0, 9)
|
b = random.randrange(0, 9)
|
||||||
while b in a:
|
while b in a:
|
||||||
b = random.randrange(1, 49)
|
b = random.randrange(1, 49)
|
||||||
lotto = str(a) + ',Superzahl: ' + str(b)
|
lotto = str(a) + ',Superzahl: ' + str(b)
|
||||||
|
lottoa=a
|
||||||
|
lottoa.append(b)
|
||||||
return lotto
|
return lotto
|
||||||
|
|
||||||
pfad = os.path.dirname(__file__)
|
pfad = os.path.dirname(__file__)
|
||||||
|
|
@ -134,6 +137,7 @@ mail = 0
|
||||||
jetzt = int(time.strftime('%j'))
|
jetzt = int(time.strftime('%j'))
|
||||||
tag = time.strftime('%d')
|
tag = time.strftime('%d')
|
||||||
wtag = time.strftime('%w')
|
wtag = time.strftime('%w')
|
||||||
|
timestamp=time.strftime("%d.%m.%Y %H:%M:%S")
|
||||||
mailzusatz=""
|
mailzusatz=""
|
||||||
ferien = False
|
ferien = False
|
||||||
ferien_morgen = False
|
ferien_morgen = False
|
||||||
|
|
@ -355,12 +359,16 @@ if mail!=0 or jsonpass['debug']=='True':
|
||||||
'\nViel Spass, bei allem, was ihr so treibt\n'+ \
|
'\nViel Spass, bei allem, was ihr so treibt\n'+ \
|
||||||
'\nZitat des Tages:\n'+ jsonpass['zitat']+ \
|
'\nZitat des Tages:\n'+ jsonpass['zitat']+ \
|
||||||
"\nAutor: " + jsonpass['autor'] + '\n'
|
"\nAutor: " + jsonpass['autor'] + '\n'
|
||||||
if wtag == '3':
|
if wtag == '3' or jsonpass['debug']=='True':
|
||||||
lotto=Lotto()
|
lotto=Lotto()
|
||||||
mailzusatz = '\n \nHallo Mittwoch!\nIch wünsche eine schöne Wochenmitte.\nKopf hoch! ' \
|
mailzusatz = '\n \nHallo Mittwoch!\nIch wünsche eine schöne Wochenmitte.\nKopf hoch! ' \
|
||||||
+ 'Wenn ich Lotto spielen würde, dann kämen heute folgende Zahlen zum Einsatz: ' +lotto +\
|
+ 'Wenn ich Lotto spielen würde, dann kämen heute folgende Zahlen zum Einsatz: ' +lotto +\
|
||||||
'\n\nZitat des Tages:\n'+ jsonpass['zitat']+ \
|
'\n\nZitat des Tages:\n'+ jsonpass['zitat']+ \
|
||||||
"\nAutor: " + jsonpass['autor'] + '\n'
|
"\nAutor: " + jsonpass['autor'] + '\n'
|
||||||
|
jsonpass['lotto'] = lottoa
|
||||||
|
jsonpass['lotto_timestamp']=timestamp
|
||||||
|
with open(pfad + '/pass.json', 'w') as fp:
|
||||||
|
json.dump(jsonpass, fp, sort_keys=True, indent=4)
|
||||||
if wtag == '4':
|
if wtag == '4':
|
||||||
mailzusatz = '\n \nDer Donnerstag ist bekanntlich der \'kleine Freitag\'' \
|
mailzusatz = '\n \nDer Donnerstag ist bekanntlich der \'kleine Freitag\'' \
|
||||||
'\nNur noch einmal (!) Gas geben!\n' '\nZitat des Tages:\n'+ jsonpass['zitat']+\
|
'\nNur noch einmal (!) Gas geben!\n' '\nZitat des Tages:\n'+ jsonpass['zitat']+\
|
||||||
|
|
@ -372,9 +380,14 @@ if mail!=0 or jsonpass['debug']=='True':
|
||||||
' Glück beim Lotto. Probiert doch mal diese Zahlen: '+lotto+\
|
' Glück beim Lotto. Probiert doch mal diese Zahlen: '+lotto+\
|
||||||
'\n\nZitat des Tages:\n'+ jsonpass['zitat']+\
|
'\n\nZitat des Tages:\n'+ jsonpass['zitat']+\
|
||||||
'\nAutor: '+jsonpass['autor']+'\n'
|
'\nAutor: '+jsonpass['autor']+'\n'
|
||||||
|
jsonpass['lotto'] = lottoa
|
||||||
|
jsonpass['lotto_timestamp'] = timestamp
|
||||||
|
with open(pfad + '/pass.json', 'w') as fp:
|
||||||
|
json.dump(jsonpass, fp, sort_keys=True, indent=4)
|
||||||
else:
|
else:
|
||||||
print ('im Westen nix neues')
|
print ('im Westen nix neues')
|
||||||
|
|
||||||
|
|
||||||
if jsonpass['debug']=="True":
|
if jsonpass['debug']=="True":
|
||||||
update()
|
update()
|
||||||
print('DEBUG_MODE')
|
print('DEBUG_MODE')
|
||||||
|
|
|
||||||
30
pass.json
30
pass.json
|
|
@ -2,11 +2,31 @@
|
||||||
"Chat_ID": "@mpglu",
|
"Chat_ID": "@mpglu",
|
||||||
"Land": "rp",
|
"Land": "rp",
|
||||||
"TOKEN": "467241832:AAH3e0y6Fm7ig5DtConJP29GsD-zX1psNZo",
|
"TOKEN": "467241832:AAH3e0y6Fm7ig5DtConJP29GsD-zX1psNZo",
|
||||||
"Tag_Name": "Tuesday",
|
"Tag_Name": "Thursday",
|
||||||
"Tag_Nummer": "1508865191",
|
"Tag_Nummer": "4",
|
||||||
"Uhrzeit": "2",
|
"Uhrzeit": "12:06:23",
|
||||||
"Wochentag": "2",
|
"autor": "Emil G\u00f6tt",
|
||||||
"ccu_ip": "10.0.1.100",
|
"ccu_ip": "10.0.1.100",
|
||||||
|
"debug": "True",
|
||||||
|
"debug_Chat_ID": "322673713",
|
||||||
|
"debug_TOKEN": "312534798:AAFbMjS-tfd2BiZ_j3NEZuQYKwzACMcioVo",
|
||||||
|
"debug_adress": "carsten@hubobel.de",
|
||||||
"gmail_pass": "PL19zPL19z",
|
"gmail_pass": "PL19zPL19z",
|
||||||
"gmail_user": "carsten.richter77@gmail.com"
|
"gmail_user": "carsten.richter77@gmail.com",
|
||||||
|
"lotto": [
|
||||||
|
2,
|
||||||
|
15,
|
||||||
|
20,
|
||||||
|
21,
|
||||||
|
42,
|
||||||
|
44,
|
||||||
|
7
|
||||||
|
],
|
||||||
|
"lotto_timestamp": "07.12.2017 12:06:23",
|
||||||
|
"mpg_pass": "Ing8gresk",
|
||||||
|
"mpg_user": "schueler",
|
||||||
|
"pfad": "/Users/hubobel/Documents/Python/HubobelsPython",
|
||||||
|
"wetter_API": "35a8e37c649985d5",
|
||||||
|
"wetter_Ort": "ILUDWIGS227",
|
||||||
|
"zitat": "Was du verlieren kannst, hat keinen Wert."
|
||||||
}
|
}
|
||||||
42
test 2.py
42
test 2.py
|
|
@ -1,42 +0,0 @@
|
||||||
import requests
|
|
||||||
import random
|
|
||||||
|
|
||||||
def Lotto():
|
|
||||||
a = (sorted(random.sample(range(1, 49), 6)))
|
|
||||||
b = random.randrange(0, 9)
|
|
||||||
while b in a:
|
|
||||||
b = random.randrange(1, 9)
|
|
||||||
lotto = str(a) + ',Superzahl: ' + str(b)
|
|
||||||
return lotto,a,b
|
|
||||||
|
|
||||||
url_zitat = 'http://api.hubobel.de/lotto/Mittwoch'
|
|
||||||
resp_zitat = requests.get(url_zitat)
|
|
||||||
data_zitat = resp_zitat.json()
|
|
||||||
|
|
||||||
|
|
||||||
inhalt=data_zitat[1]
|
|
||||||
a=[]
|
|
||||||
|
|
||||||
count=1
|
|
||||||
|
|
||||||
while count<7:
|
|
||||||
index=str('Z'+str(count))
|
|
||||||
a.append(inhalt[index])
|
|
||||||
count=count+1
|
|
||||||
|
|
||||||
|
|
||||||
b,c,d=Lotto()
|
|
||||||
|
|
||||||
|
|
||||||
treffer=0
|
|
||||||
ergebniss=[]
|
|
||||||
superzahl=''
|
|
||||||
for i in c:
|
|
||||||
if i in a:
|
|
||||||
treffer=treffer+1
|
|
||||||
ergebniss.append(i)
|
|
||||||
if d == inhalt['Superzahl']:
|
|
||||||
superzahl=' und die Superzahl!'
|
|
||||||
print('Die aktuellen Lottozahlen der '+inhalt['Datum']+' lauten: '+str(a)+',Superzahl: '+str(inhalt['Superzahl']))
|
|
||||||
print('Sie haben getippt: '+ b)
|
|
||||||
print('Sie haben '+str(treffer)+' Richtige '+str(ergebniss)+superzahl)
|
|
||||||
49
test.py
49
test.py
|
|
@ -1,12 +1,39 @@
|
||||||
|
import pymysql
|
||||||
|
import bs4 as bs
|
||||||
import requests
|
import requests
|
||||||
from
|
|
||||||
file = open("LOTTO_ab_2017.csv", "br")
|
connection = pymysql.connect(db="hubobel",
|
||||||
file=requests.get('http://www.lottotip-check.de')
|
user="hubobel",
|
||||||
#csv_reader = csv.reader(file, delimiter=",")
|
passwd="polier2003",
|
||||||
a=[]
|
host='10.0.1.59',charset='utf8')
|
||||||
for row in file:
|
cursor = connection.cursor()
|
||||||
print(row)
|
|
||||||
a.append(row)
|
#todo eurojackpot wieder fixen
|
||||||
file.close()
|
|
||||||
print(len(a))
|
requests.packages.urllib3.disable_warnings()
|
||||||
print(a[len(a)-5])
|
sauce = requests.get('https://www.eurojackpot.org/gewinnzahlen/', verify=False)
|
||||||
|
soup = bs.BeautifulSoup(sauce.text, 'lxml')
|
||||||
|
#print(soup)
|
||||||
|
#print(soup)
|
||||||
|
# zahlen = []
|
||||||
|
# ergebniss = []
|
||||||
|
ZahlenEuro = {'Datum': '', 'Z1': '', 'Z2': '', 'Z3': '', 'Z4': '', 'Z5': '', 'Eurozahl1': '', 'Eurozahl2': ''}
|
||||||
|
a = 1
|
||||||
|
datum = soup.find_all('li')
|
||||||
|
for i in datum:
|
||||||
|
i=str(i)
|
||||||
|
i = i.replace('<li>' , '').replace('</li>' , '').replace('<li class="extra">' , '')
|
||||||
|
if a <= 7:
|
||||||
|
if a<6:
|
||||||
|
ZahlenEuro['Z'+str(a)]=i
|
||||||
|
if a ==6:
|
||||||
|
ZahlenEuro['Eurozahl1']=i
|
||||||
|
if a ==7:
|
||||||
|
ZahlenEuro['Eurozahl2']=i
|
||||||
|
a +=1
|
||||||
|
|
||||||
|
#print(soup)
|
||||||
|
sauce=(soup.find_all('div', class_ ='calendar'))
|
||||||
|
date=(soup.select_one('input[id=calendar]')['value'])
|
||||||
|
ZahlenEuro['Datum']=date
|
||||||
|
print(ZahlenEuro)
|
||||||
54
tv_wrapper.py
Normal file
54
tv_wrapper.py
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
import bs4 as bs
|
||||||
|
import requests as req
|
||||||
|
mode=3
|
||||||
|
if mode == 0:
|
||||||
|
mode = 'jetzt'
|
||||||
|
if mode == 1:
|
||||||
|
mode = 'abends'
|
||||||
|
if mode == 3:
|
||||||
|
mode = 'fernsehprogramm-nachts'
|
||||||
|
Sendungen = {}
|
||||||
|
x = 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Sendungen={}
|
||||||
|
x=1
|
||||||
|
while x<=7:
|
||||||
|
sauce = req.get('http://www.tvspielfilm.de/tv-programm/sendungen/' + mode + '.html?page=' + str(x), verify=False)
|
||||||
|
soup = bs.BeautifulSoup(sauce.text, 'lxml')
|
||||||
|
|
||||||
|
sender_source = soup.find_all('td', class_='programm-col1')
|
||||||
|
sendungen_source= soup.find_all('strong')
|
||||||
|
|
||||||
|
Sender=[]
|
||||||
|
Sendung=[]
|
||||||
|
|
||||||
|
for i in sendungen_source:
|
||||||
|
Sendung.append(i.text)
|
||||||
|
for i in sender_source:
|
||||||
|
text=i.text
|
||||||
|
text=text.replace('\n','')
|
||||||
|
text = text.replace(' ', '')
|
||||||
|
Sender.append(text)
|
||||||
|
Sendung.pop(0) #erstes Element des Listenelements 'Sendung' wird entfernt
|
||||||
|
programm={}
|
||||||
|
a=0
|
||||||
|
b=0
|
||||||
|
|
||||||
|
while a<len(Sender):
|
||||||
|
programm['Uhrzeit']=Sendung[b]
|
||||||
|
programm['Titel']=Sendung[b+1]
|
||||||
|
Sendungen[Sender[a]]={}
|
||||||
|
Sendungen[Sender[a]].update(programm)
|
||||||
|
a+=1
|
||||||
|
b+=2
|
||||||
|
x+=1
|
||||||
|
|
||||||
|
liste=[]
|
||||||
|
for i in Sendungen:
|
||||||
|
liste.append(i)
|
||||||
|
Sendungen['0:Sender']=liste
|
||||||
|
print(Sendungen)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue