Compare commits

..

No commits in common. "Master" and "TC01" have entirely different histories.
Master ... TC01

2852 changed files with 96 additions and 849032 deletions

2
.idea/.gitignore generated vendored
View file

@ -1,2 +0,0 @@
# Default ignored files
/workspace.xml

View file

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.10" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View file

@ -1,12 +0,0 @@
<component name="ProjectDictionaryState">
<dictionary name="hubobel">
<words>
<w>diese</w>
<w>farbe</w>
<w>fyeg</w>
<w>gibt</w>
<w>gibts</w>
<w>nicht</w>
</words>
</dictionary>
</component>

4
.idea/encodings.xml generated
View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
</project>

7
.idea/misc.xml generated
View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10" project-jdk-type="Python SDK" />
<component name="PyCharmProfessionalAdvertiser">
<option name="shown" value="true" />
</component>
</project>

8
.idea/modules.xml generated
View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/HubobelsPython.iml" filepath="$PROJECT_DIR$/.idea/HubobelsPython.iml" />
</modules>
</component>
</project>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,23 +0,0 @@
import requests
import telebot
TOKEN='680737840:AAEaa7Vxl_kZz_LWS1_S-lH6Eda7HXqu6Y4'
ChatID='322673713'
tb = telebot.TeleBot(TOKEN)
url_zitat = 'https://dbf.finalrewind.org/alzeyhbf.json?version=3'
resp_zitat = requests.get(url_zitat)
data_zitat = resp_zitat.json()
antwort=''
telegramm='Mainz - Alzey\n'
for i in data_zitat['departures']:
if i['train'] == 'RB 31':
print(i)
print(telegramm)
#tb.send_message(ChatID,telegramm)

View file

@ -1,153 +0,0 @@
#dsfsf
import requests
import telebot
import datetime
import json
from datetime import datetime as DateTime
hour = datetime.datetime.now().hour
TOKEN='680737840:AAEaa7Vxl_kZz_LWS1_S-lH6Eda7HXqu6Y4'
ChatID='322673713'
tb = telebot.TeleBot(TOKEN)
ort = '/home/carsten/Scripts/'
ort = ''
Zeitstempel = DateTime.now().strftime('%Y_%m_%d_%H_%M_%S')
antwort=''
def mzwi():
url_zitat = 'https://dbf.finalrewind.org/mainzhbf.json?version=3'
resp_zitat = requests.get(url_zitat)
data_zitat = resp_zitat.json()
telegramm = 'Mainz - Wiesbaden\n'
with open(ort + str(Zeitstempel) + '_data.txt', 'w') as outfile:
json.dump(data_zitat, outfile)
for i in data_zitat['departures']:
if i['train'] == "S 8":
if i['destination'] == 'Wiesbaden Hbf':
antwort = (i['train'] + ' ' + i['platform'] + ' ' + str(i['scheduledDeparture']))
if i['isCancelled'] != 1:
if i['delayDeparture'] != 0:
antwort = antwort + (' Verspätung: ' + str(i['delayDeparture']) + ' Minuten')
else:
antwort = antwort + ' PÜNKTLICH'
else:
antwort = antwort + 'CANCELLED!!!'
telegramm = telegramm + antwort + '\n'
if i['train'] == "RB 75":
if i['isCancelled'] != 1:
if i['delayDeparture'] != 0:
antwort = antwort + (' Verspätung: ' + str(i['delayDeparture']) + ' Minuten')
else:
antwort = antwort + ' PÜNKTLICH'
else:
antwort = antwort + 'CANCELLED!!!'
telegramm = telegramm + antwort + '\n'
return telegramm
def wimz():
url_zitat = 'https://dbf.finalrewind.org/Wiesbadenhbf.json?version=3'
resp_zitat = requests.get(url_zitat)
data_zitat = resp_zitat.json()
telegramm = 'Wiesbaden - Mainz\n'
with open(ort + str(Zeitstempel) + '_data.txt', 'w') as outfile:
json.dump(data_zitat, outfile)
for i in data_zitat['departures']:
if i['train'] == "S 8":
if i['destination'] == 'Offenbach(Main)Ost':
antwort = (i['train'] + ' ' + i['platform'] + ' ' + str(i['scheduledDeparture']))
if i['isCancelled'] != 1:
if i['delayDeparture'] != 0:
antwort = antwort + (' Verspätung: ' + str(i['delayDeparture']) + ' Minuten')
else:
antwort = antwort + ' PÜNKTLICH'
else:
antwort = antwort + 'CANCELLED!!!'
telegramm = telegramm + antwort + '\n'
if i['train'] == "RB 75":
if i['destination'] == 'Aschaffenburg Hbf':
antwort = (i['train'] + ' ' + i['platform'] + ' ' + str(i['scheduledDeparture']))
if i['isCancelled'] != 1:
if i['delayDeparture'] != 0:
antwort = antwort + (' Verspätung: ' + str(i['delayDeparture']) + ' Minuten')
else:
antwort = antwort + ' PÜNKTLICH'
else:
antwort = antwort + 'CANCELLED!!!'
telegramm = telegramm + antwort + '\n'
return telegramm
def mzaz():
url_zitat = 'https://dbf.finalrewind.org/mainzhbf.json?version=3'
resp_zitat = requests.get(url_zitat)
data_zitat = resp_zitat.json()
telegramm = 'Mainz - Alzey\n'
with open(ort + str(Zeitstempel) + '_data.txt', 'w') as outfile:
json.dump(data_zitat, outfile)
for i in data_zitat['departures']:
if i['train'] == "RE 13":
if i['delayDeparture'] != None:
antwort = (i['train'] + ' ' + i['platform'] + ' ' + str(i['scheduledDeparture']))
if i['isCancelled'] != 1:
if i['delayDeparture'] != 0:
antwort = antwort + (' Verspätung: ' + str(i['delayDeparture']) + ' Minuten')
else:
antwort = antwort + ' PÜNKTLICH'
else:
antwort = antwort + 'CANCELLED!!!'
telegramm = telegramm + antwort + '\n'
if i['train'] == "RB 31":
if i['delayDeparture'] != None:
antwort = (i['train'] + ' ' + i['platform'] + ' ' + str(i['scheduledDeparture']))
if i['isCancelled'] != 1:
if i['delayDeparture'] != 0:
antwort = antwort + (' Verspätung: ' + str(i['delayDeparture']) + ' Minuten')
else:
antwort = antwort + ' PÜNKTLICH'
else:
antwort = antwort + 'CANCELLED!!!'
telegramm = telegramm + antwort + '\n'
return telegramm
def azmz():
url_zitat = 'https://dbf.finalrewind.org/alzeyhbf.json?version=3'
resp_zitat = requests.get(url_zitat)
data_zitat = resp_zitat.json()
telegramm = 'Alzey - Mainz\n'
with open(ort + str(Zeitstempel) + '_data.txt', 'w') as outfile:
json.dump(data_zitat, outfile)
for i in data_zitat['departures']:
# print(i)
if i['train'] == "RE 13":
# print(i)
if i['destination'] == 'Mainz Hbf':
antwort = (i['train'] + ' ' + i['platform'] + ' ' + str(i['scheduledDeparture']))
if i['isCancelled'] != 1:
if i['delayDeparture'] != 0:
antwort = antwort + (' Verspätung: ' + str(i['delayDeparture']) + ' Minuten')
else:
antwort = antwort + ' PÜNKTLICH'
else:
antwort = antwort + 'CANCELLED!!!'
telegramm = telegramm + antwort + '\n'
if i['train'] == "RB 31":
if i['destination'] == 'Mainz Hbf':
antwort = (i['train'] + ' ' + i['platform'] + ' ' + str(i['scheduledDeparture']))
if i['isCancelled'] != 1:
if i['delayDeparture'] != 0:
antwort = antwort + (' Verspätung: ' + str(i['delayDeparture']) + ' Minuten')
else:
antwort = antwort + ' PÜNKTLICH'
else:
antwort = antwort + 'CANCELLED!!!'
telegramm = telegramm + antwort + '\n'
return telegramm
if hour <=12:
sendto=(azmz())+'\n'+mzwi()
tb.send_message(ChatID, sendto)
if hour >=13:
sendto = (wimz()) + '\n' + mzaz()
tb.send_message(ChatID, sendto)

BIN
Bild

Binary file not shown.

Before

Width:  |  Height:  |  Size: 388 KiB

View file

View file

@ -1,31 +0,0 @@
import poplib
mymail = []
host = "pop3.web.de"
mail = poplib.POP3_SSL(host)
print (mail.getwelcome())
print (mail.user("schneeschieben@web.de"))
print (mail.pass_("Winter19&"))
print (mail.stat())
print (mail.list())
print ("")
if mail.stat()[1] > 0:
print ("You have new mail.")
else:
print ("No new mail.")
print ("")
numMessages = len(mail.list()[1])
numb=0
for i in range(numMessages):
for j in mail.retr(i+1)[1]:
numb+=1
#print(j)
if numb == 4 or numb == 5:
print(j)
mail.quit()
input("Press any key to continue.")

View file

@ -1,116 +0,0 @@
# -*- coding: UTF8 -*-
import requests
import pymysql
class BotHandler:
def __init__(self, token):
self.token = token
self.api_url = "https://api.telegram.org/bot{}/".format(token)
#url = "https://api.telegram.org/bot<token>/"
def get_updates(self, offset=0, timeout=30):
method = 'getUpdates'
params = {'timeout': timeout, 'offset': offset}
resp = requests.get(self.api_url + method, params)
result_json = resp.json()['result']
return result_json
def send_message(self, chat_id, text):
params = {'chat_id': chat_id, 'text': text, 'parse_mode': 'HTML'}
method = 'sendMessage'
resp = requests.post(self.api_url + method, params)
return resp
def get_first_update(self):
get_result = self.get_updates()
if len(get_result) > 0:
last_update = get_result[0]
else:
last_update = None
return last_update
token = '1030619458:AAGTrWO2-m38ViL0y2R8XaV0P1gg8kHxj3o' #Token of your bot
magnito_bot = BotHandler(token) #Your bot's name
def main():
new_offset = 0
print('hi, now launching...')
while True:
all_updates=magnito_bot.get_updates(new_offset)
if len(all_updates) > 0:
for current_update in all_updates:
print(current_update)
first_update_id = current_update['update_id']
if 'text' not in current_update['message']:
first_chat_text='New member'
else:
first_chat_text = current_update['message']['text']
first_chat_id = current_update['message']['chat']['id']
if 'first_name' in current_update['message']:
first_chat_name = current_update['message']['chat']['first_name']
elif 'new_chat_member' in current_update['message']:
first_chat_name = current_update['message']['new_chat_member']['username']
elif 'from' in current_update['message']:
first_chat_name = current_update['message']['from']['first_name']
else:
first_chat_name = "unknown"
signal = first_chat_text[0:5]
if signal == '/0815':
magnito_bot.send_message(first_chat_id, 'Ich lausche deinem Befehl ' + first_chat_name)
new_offset = first_update_id + 1
connection = pymysql.connect(db="hubobel",
user="hubobel",
passwd="polier2003",
host='10.0.1.59', charset='utf8')
cursor = connection.cursor()
sql = "SELECT * FROM facts ORDER BY nr DESC"
resp = cursor.execute(sql)
x = int(resp)
magnito_bot.send_message(first_chat_id, 'Es gibt derzeit ' + str(x) + ' Facts')
fact = first_chat_text[6:]
sql = "INSERT INTO `facts`(`nr`, `fact`) VALUES ('" + str(x+1) + "','" + fact + "')"
sql_q = "SELECT * FROM facts WHERE fact like '%" + fact + "%'"
resp = cursor.execute(sql_q)
if resp == 0:
try:
resp = cursor.execute(sql)
magnito_bot.send_message(first_chat_id, 'Ich habe diesen Fact an SQL übertragen: ' + fact)
except:
magnito_bot.send_message(first_chat_id, 'Ich hatte ein Problem, den Fact an SQL zu übermitteln!')
else:
magnito_bot.send_message(first_chat_id, 'Den Fact "' + fact+ ' "gibt es schon in meiner Database!')
connection.commit()
cursor.close()
connection.close()
else:
if first_chat_text == 'Hi':
magnito_bot.send_message(first_chat_id, 'Morning ' + first_chat_name)
new_offset = first_update_id + 1
elif first_chat_text == 'Wer bin ich':
magnito_bot.send_message(first_chat_id, 'Du bist der Größte '+ signal)
new_offset = first_update_id + 1
else:
magnito_bot.send_message(first_chat_id, 'How are you doing '+first_chat_name)
new_offset = first_update_id + 1
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
exit()

View file

@ -1,83 +0,0 @@
#!/usr/bin/python
import datetime
import logging
import urllib2
#import scapy
# Constants
timespan_threshhold = 3
# Globals
lastpress = datetime.datetime(1970, 1, 1)
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from scapy.all import *
def button_pressed_dash1():
global lastpress
thistime = datetime.datetime.now()
timespan = thistime - lastpress
if timespan.total_seconds() > timespan_threshhold:
current_time = datetime.datetime.strftime(thistime, '%Y-%m-%d %H:%M:%S')
print
'Dash button pressed at ' + current_time
urllib2.urlopen('http://10.0.1.100:8181/loksoft.exe?ret=dom.GetObject("Dash1").State(1)')
def button_pressed_dash2():
global lastpress
thistime = datetime.datetime.now()
timespan = thistime - lastpress
if timespan.total_seconds() > timespan_threshhold:
current_time = datetime.datetime.strftime(thistime, '%Y-%m-%d %H:%M:%S')
print
'Dash button pressed at ' + current_time
urllib2.urlopen('http://10.0.1.100:8181/loksoft.exe?ret=dom.GetObject("Dash2").State(1)')
def button_pressed_dash3():
global lastpress
thistime = datetime.datetime.now()
timespan = thistime - lastpress
if timespan.total_seconds() > timespan_threshhold:
current_time = datetime.datetime.strftime(thistime, '%Y-%m-%d %H:%M:%S')
print
'Dash button pressed at ' + current_time
urllib2.urlopen('http://10.0.1.100:8181/loksoft.exe?ret=dom.GetObject("Dash3").State(1)')
def button_pressed_dash4():
global lastpress
thistime = datetime.datetime.now()
timespan = thistime - lastpress
if timespan.total_seconds() > timespan_threshhold:
current_time = datetime.datetime.strftime(thistime, '%Y-%m-%d %H:%M:%S')
print
'Dash button pressed at ' + current_time
urllib2.urlopen('http://10.0.1.100:8181/loksoft.exe?ret=dom.GetObject("Dash3").State(1)')
lastpress = thistime
def udp_filter(pkt):
options = pkt[DHCP].options
for option in options:
if isinstance(option, tuple):
if 'requested_addr' in option:
# we've found the IP address, which means its the second and final UDP request, so we can trigger our action
mac_to_action[pkt.src]()
break
mac_to_action = {'ac:63:be:f8:54:72': button_pressed_dash2, '50:f5:da:1a:6b:39': button_pressed_dash1,
'50:f5:da:5c:c1:59': button_pressed_dash3, 'ac:63:be:4f:41:a1': button_pressed_dash4}
mac_id_list = list(mac_to_action.keys())
print
"Waiting for a button press..."
sniff(prn=udp_filter, store=0, filter="udp", lfilter=lambda d: d.src in mac_id_list)
if __name__ == "__main__":
main()

View file

@ -1,43 +0,0 @@
import datetime
import shutil
import traceback
import sys
if len(sys.argv) != 2:
tage = 10
else:
tage = int(sys.argv[1])
now = (datetime.datetime.now() - datetime.timedelta(tage))
day = now.strftime("%d")
month = now.strftime("%m")
year = now.strftime("%Y")
pfadflur="/mnt/usb/cameras/flur/"+year+"/"+month+"/"+day
pfadgarten="/mnt/usb/cameras/garten/"+year+"/"+month+"/"+day
pfadwz="/mnt/usb/cameras/wz/"+year+"/"+month+"/"+day
pfadhaustuer="/mnt/usb/cameras/haustuer/"+year+"/"+month+"/"+day
try:
shutil.rmtree(pfadflur)
print('L sche '+ pfadflur)
except Exception as e:
print('Beim Löschen kam es zu folgendem Fehler: ' + str(e))
try:
shutil.rmtree(pfadgarten)
print('L sche '+ pfadgarten)
except Exception as e:
print('Beim Löschen kam es zu folgendem Fehler: ' + str(e))
try:
shutil.rmtree(pfadwz)
print('L sche '+ pfadwz)
except Exception as e:
print('Beim Löschen kam es zu folgendem Fehler: ' + str(e))
try:
shutil.rmtree(pfadhaustuer)
print('L sche '+ pfadhaustuer)
except Exception as e:
print('Beim Löschen kam es zu folgendem Fehler: ' + str(e))

Binary file not shown.

View file

@ -1,26 +0,0 @@
import dropbox
import os
access_token = 'wolWNcuUBx8AAAAAAAAAAewgSIDDcM7gBELKKuQyTup-iaMigFASlRULaav4e_N7'
dbx = dropbox.Dropbox(access_token)
a = os.getcwd() + "/Stick/"
b = os.getcwd() + "/testa/"
inhalta = (os.listdir(a))
for i in inhalta:
with open(a + str(i), 'rb') as f:
dbx.files_upload(f.read(), '/' + str(i))
inhalt = dbx.files_list_folder('')
for entry in dbx.files_list_folder('').entries:
print(entry.name)
download_Path = b + entry.name
dropbox_Path = '/' + entry.name
dbx.files_download_to_file(download_Path, dropbox_Path)

View file

@ -1,32 +0,0 @@
import bs4 as bs
import requests
requests.packages.urllib3.disable_warnings()
sauce = requests.get('https://www.lotto24.de/webshop/product/eurojackpot/result', verify=False)
soup = bs.BeautifulSoup(sauce.text, 'lxml')
ZahlenEuro = {'Datum': '', 'Z1': '', 'Z2': '', 'Z3': '', 'Z4': '', 'Z5': '', 'Eurozahl1': '', 'Eurozahl2': ''}
a = 1
daten = soup.find_all('div', class_="winning-numbers__number")
for i in daten:
print(i.text)
if a <= 5:
ZahlenEuro['Z' + str(a)] = int(i.text)
elif a == 6:
ZahlenEuro['Eurozahl1'] = int(i.text)
elif a == 7:
ZahlenEuro['Eurozahl2'] = int(i.text)
a = a + 1
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'))
ZahlenEuro['Datum'] = date[start:ende]
print(ZahlenEuro)

View file

@ -1,5 +0,0 @@
import xml.etree.ElementTree as ET
tree = ET.parse("export_job_logResponse.xml")
root = tree.getroot()
links = root.findall("{http://www.kyoceramita.com/ws/km-wsdl/log/log_information}export_job_log")
print(links)

View file

@ -1,84 +0,0 @@
import requests
import json
import time
import datetime
import os
pfad = os.path.dirname(__file__)
url_ferien ='http://api.smartnoob.de/ferien/v1/ferien/?bundesland=rp'
url_feiertage = 'http://api.smartnoob.de/ferien/v1/feiertage/?bundesland=rp'
jetzt = int(time.strftime('%j'))
tag = time.strftime('%d')
ferien = False
feiertag = False
if int(tag) == 1: #Update einmal pro Monat
print("Update Time!!!")
resp_ferien = requests.get(url_ferien)
resp_feiertage = requests.get(url_feiertage)
data_ferien = resp_ferien.json()
data_feiertage = resp_feiertage.json()
with open(pfad + '/json_ferien.data', 'w') as outfile:
json.dump(data_ferien, outfile)
with open(pfad + '/json_feiertage.data', 'w') as outfile:
json.dump(data_feiertage, outfile)
if os.path.isfile(pfad+'/json_ferien.data')!= True: #Download der json, falls diese lokal nicht existieren
print('nicht da!!!')
resp_ferien = requests.get(url_ferien)
resp_feiertage = requests.get(url_feiertage)
data_ferien = resp_ferien.json()
data_feiertage = resp_feiertage.json()
with open(pfad+'/json_ferien.data','w') as outfile:
json.dump(data_ferien, outfile)
with open(pfad+'/json_feiertage.data','w') as outfile:
json.dump(data_feiertage, outfile)
with open(pfad+'/json_ferien.data') as file:
data_ferien=json.load(file)
with open(pfad+'/json_feiertage.data') as file:
data_feiertage=json.load(file)
a= len(data_ferien['daten'])
x = 0
while x <a:
beginn = data_ferien['daten'][x]['beginn']
beginn = datetime.datetime.fromtimestamp(beginn)
beginn = int(beginn.strftime('%j'))
ende = data_ferien['daten'][x]['ende']
ende = datetime.datetime.fromtimestamp(ende)
ende = int(ende.strftime('%j'))-1
if jetzt <= ende and jetzt >= beginn:
ferien = True
x = x+1
a= len(data_feiertage['daten'])
x = 0
while x <a:
beginn = data_feiertage['daten'][x]['beginn']
beginn = datetime.datetime.fromtimestamp(beginn)
beginn = int(beginn.strftime('%j'))
ende = data_feiertage['daten'][x]['ende']
ende = datetime.datetime.fromtimestamp(ende)
ende = int(ende.strftime('%j'))-1
if jetzt <= ende and jetzt >= beginn:
feiertag = True
x = x+1
print('Es sind Ferien: '+ str(ferien))
print('Es ist ein Feiertag: '+str(feiertag))

View file

@ -1,61 +0,0 @@
# -*- coding: utf-8 -*-
import bs4 as bs
import requests
import pymysql
connection = pymysql.connect(db="hubobel",
user="hubobel",
passwd="polier2003",
host='10.0.1.59',charset='utf8')
cursor = connection.cursor()
try:
cursor.execute("""CREATE TABLE Filosofie (
Nr INTEGER, Filosofie TEXT)""")
except:
print('Error')
None
sql = "SELECT * FROM Filosofie ORDER BY Nr DESC"
resp = cursor.execute(sql)
AnzahlStart = resp
db = []
ergebniss = ''
requests.packages.urllib3.disable_warnings()
sauce = requests.get('https://www.swr3.de/wraps/fun/filosofie/neu.php?id=1300', verify=False)
soup = bs.BeautifulSoup(sauce.text, 'lxml')
for i in soup.find_all('div'):
ergebniss = ergebniss+str(i)
start = (ergebniss.find('href="/wraps/fun/filosofie/neu.php?id=1152&amp;cf=42"> weiter &gt; </a>   <a class="linkred" href='))
print(ergebniss)
anzahl = int(ergebniss[start+131:start+135])
start = int(resp)+1+110
while start <= anzahl:
url='https://www.swr3.de/wraps/fun/filosofie/neu.php?id='+str(start)
sauce = requests.get(url, verify=False)
soup = bs.BeautifulSoup(sauce.content,'lxml')
for i in soup.find_all('strong'):
filosophie=(i.text)
#print(filosophie)
#print(start,' von ',anzahl)
sql = "INSERT INTO `Filosofie`(`Nr`, `Filosofie`) VALUES ('" + str(start) + "','" + filosophie + "')"
sql_q = "SELECT * FROM Filosofie WHERE Filosofie like '%" + str(filosophie) + "%'"
try:
resp = cursor.execute(sql_q)
if resp == 0:
try:
resp = cursor.execute(sql)
db.append(filosophie)
except:
print('Es gab ein Problem beim Schreiben des facts in die DB')
except:
None
connection.commit()
start +=1
sql = "SELECT * FROM Filosofie ORDER BY Nr DESC"
AnzahlEnde = cursor.execute(sql)
print('Es wurden ', int(AnzahlEnde) - int(AnzahlStart), ' neue Filosofien der DB hinzugefügt.')
if len(db)>0:
for i in db:
print(i)
cursor.close()
connection.close()

View file

@ -1,30 +0,0 @@
import requests as req
import bs4 as bs
req.packages.urllib3.disable_warnings()
sauce = req.get(
'https://www.sachsenlotto.de/portal/zahlen-quoten/gewinnzahlen/eurojackpot-gewinnzahlen/eurojackpot-gewinnzahlen.jsp',
verify=False)
soup = bs.BeautifulSoup(sauce.text, 'lxml')
zahlen = []
ergebniss = []
ZahlenEuro = {'Datum': '', 'Z1': '', 'Z2': '', 'Z3': '', 'Z4': '', 'Z5': '', 'Eurozahl1': '', 'Eurozahl2': ''}
a = 1
source = soup.find_all('span',
class_='sl-statistic-number-circle-container-filled col-lg-1 col-md-1 col-sm-1 col-xs-1')
for i in source:
zahlen.append(i.text)
while a <= 5:
ZahlenEuro['Z' + str(a)] = int(zahlen[a - 1])
a += 1
ZahlenEuro['Eurozahl1'] = zahlen[5]
ZahlenEuro['Eurozahl2'] = zahlen[6]
print(ZahlenEuro)
#print(soup)
source = soup.find_all('li')
print(source)
for i in source:
datum = i.text
print(i)

View file

@ -1,13 +0,0 @@
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')

View file

@ -1,29 +0,0 @@
import tkinter
class MyApp(tkinter.Frame):
def __init__(self, master=None):
super().__init__(master)
self.pack(padx=300,pady=200)
self.createWidgets()
def createWidgets(self):
self.nameEntry = tkinter.Entry(self)
self.nameEntry.pack(side="left")
self.name = tkinter.StringVar()
self.name.set("Ihr Name:")
self.nameEntry["textvariable"]=self.name
self.ok = tkinter.Button(self)
self.ok["text"] = "OK"
self.ok["command"] = self.quit
self.ok.pack(side="right")
self.rev = tkinter.Button(self)
self.rev["text"]="Umdrehen"
self.rev["command"]=self.onReverse
self.rev.pack(side="right")
def onReverse(self):
self.name.set(self.name.get()[::-1])
root = tkinter.Tk()
app = MyApp(root)
app.mainloop()

42
Hue.py
View file

@ -1,42 +0,0 @@
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':'On', '2002':'Dim up', '3002':'Dim down', '4002':'Off', '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',states[a])
client.disconnect()
except:
print('error')
time.sleep(1)
except:
None
time.sleep(5)
#client.disconnect()

17
IFTT.py
View file

@ -1,17 +0,0 @@
import urllib.request
import requests
import datetime
datum = datetime.datetime.now().strftime("%H:%M")
print("Choose your third string.")
c = eval(input())
#email_alert(c)
url1 = "https://maker.ifttt.com/trigger/iCloud/with/key/foLJhy361EqeESdkssI-J?value1="
url2 = "&value2="
url = url1 + c + url2 + datum
print(url)
requests.get("https://maker.ifttt.com/trigger/iCloud/with/key/foLJhy361EqeESdkssI-J?value1=test_final&value2=12:05")
requests.get(url)

View file

@ -1,21 +0,0 @@
from influxdb import InfluxDBClient
client = InfluxDBClient(host='10.0.1.59', port=8086, username='admin', password='polier2003')
#databases = client.get_list_database()
client.switch_database('iobroker')
# measurements = client.get_list_measurements()
# antwort = client.query('SELECT * FROM "javascript.0.Variablen.Tagesverbrauch" WHERE time > now() -24h')
# antwort = client.query('SELECT * FROM "javascript.0.Variablen.Tagesverbrauch" WHERE time > '+"'2020-07-16T19:16:30.665000Z' and time < '2020-07-16T19:20:30.572000Z'")
# antwort = client.query('SELECT * FROM "javascript.0.Variablen.Tagesverbrauch" WHERE time = '+"'2020-07-16T19:16:30.665000Z'")
antwort = client.query('SELECT * FROM "javascript.0.Variablen.Tagesverbrauch" WHERE time > now() -1440m and time < now() -1439m')
cpu_points = list(antwort.get_points())
print(antwort)
print(cpu_points)
print(cpu_points[0]['time'])
print(cpu_points[0]['value'])
client.close()

View file

@ -1,7 +0,0 @@
import requests
url = 'http://10.0.1.122:8087/getPlainValue/javascript.0.Variablen.Benutzer'
resp = requests.get(url)
print(resp.text)

View file

@ -1,73 +0,0 @@
import urllib.request
class kodi():
def __init__(self,url="10.0.1.102"):
self.kodiurl="http://"+url+"/jsonrpc?request=%7B%22jsonrpc%22:%20%222.0%22,%20%22method%22:%20%22Player.GetItem%22,%20%22params%22:%20%7B%20%22properties%22:%20%5B%22title%22,%20%22album%22,%20%22artist%22,%20%22season%22,%20%22episode%22,%20%22duration%22,%20%22showtitle%22,%20%22tvshowid%22,%20%22thumbnail%22,%20%22file%22,%20%22fanart%22,%20%22streamdetails%22%5D,%20%22playerid%22:%201%20%7D,%20%22id%22:%20%22VideoGetItem%22%7D"
self.jsonString = self.JSON_holen
@property
def JSON_holen(self):
try:
antwort = urllib.request.urlopen(self.kodiurl)
b = (antwort.read())
self.jsonString = b.decode("utf-8")
return self.jsonString
except:
return None
def Suchen_nach(self, suchstring, json=""):
if json=="":
self.jsonString=self.JSON_holen
else:
self.jsonString=json
start = len(suchstring) + 3
ende = len(self.jsonString)
position = self.jsonString.find("\"" + suchstring, 46,ende)
if position > 0:
position2 = self.jsonString.find(",\"", position,ende)
wert = (self.jsonString[position + start:position2])
x = 0
while wert.isalnum() is False and x < 2:
wert = wert.strip("\"}][{")
x = x + 1
return wert
return None
def kodiitem(self, koditems=None):
if koditems is None:
koditems = {'episode': "", 'label': "", 'season': "", 'showtitle': "", 'type': "", 'title': ""}
a = self.JSON_holen
if a != None:
for i in koditems:
string = self.Suchen_nach(i, a)
if type(string)==str:
string = string.replace("ä", "ae").replace("Ä", "Ae").replace("ö", "oe").replace("Ö", "oe").replace(
"ü", "ue").replace("Ü", "Ue").replace(" ", "_").replace("-1","").replace("_"," ")
elif string == None:
string =""
koditems[i] = string
if "type" in koditems == "episode":
if len("season" in koditems) == 1:
koditems["season"] = "S0" + koditems["season"]
else:
koditems["season"] = "S" + koditems["season"]
if len(koditems["episode"]) == 1:
koditems["episode"] = "E0" + koditems["episode"]
else:
koditems["episode"] = "E" + koditems["episode"]
if "type" in koditems:
test = self.Suchen_nach("label", a)
if koditems["type"] =="unknown" and test !="":
koditems["type"]="Stream"
return koditems
items = {"episode": "","width": "","duration":"","type":""}
sz = kodi("10.0.1.101")
wz = kodi("10.0.1.102")
print((sz.kodiitem()))
print((sz.JSON_holen))
print((wz.kodiitem()))
print((wz.JSON_holen))

View file

@ -1,73 +0,0 @@
import urllib.request
class kodi():
def __init__(self,url="10.0.1.102"):
self.kodiurl="http://"+url+"/jsonrpc?request=%7B%22jsonrpc%22:%20%222.0%22,%20%22method%22:%20%22Player.GetItem%22,%20%22params%22:%20%7B%20%22properties%22:%20%5B%22title%22,%20%22album%22,%20%22artist%22,%20%22season%22,%20%22episode%22,%20%22duration%22,%20%22showtitle%22,%20%22tvshowid%22,%20%22thumbnail%22,%20%22file%22,%20%22fanart%22,%20%22streamdetails%22%5D,%20%22playerid%22:%201%20%7D,%20%22id%22:%20%22VideoGetItem%22%7D"
self.jsonString = self.JSON_holen
@property
def JSON_holen(self):
try:
antwort = urllib.request.urlopen(self.kodiurl)
b = (antwort.read())
self.jsonString = b.decode("utf-8")
return self.jsonString
except:
return None
def Suchen_nach(self, suchstring, json=""):
if json=="":
self.jsonString=self.JSON_holen
else:
self.jsonString=json
start = len(suchstring) + 3
ende = len(self.jsonString)
position = self.jsonString.find("\"" + suchstring, 46,ende)
if position > 0:
position2 = self.jsonString.find(",\"", position,ende)
wert = (self.jsonString[position + start:position2])
x = 0
while wert.isalnum() is False and x < 2:
wert = wert.strip("\"}][{")
x = x + 1
return wert
return None
def kodiitem(self, koditems=None):
if koditems is None:
koditems = {'episode': "", 'label': "", 'season': "", 'showtitle': "", 'type': "", 'title': ""}
a = self.JSON_holen
if a != None:
for i in koditems:
string = self.Suchen_nach(i, a)
if type(string)==str:
string = string.replace("ä", "ae").replace("Ä", "Ae").replace("ö", "oe").replace("Ö", "oe").replace(
"ü", "ue").replace("Ü", "Ue").replace(" ", "_").replace("-1","").replace("_"," ")
elif string == None:
string =""
koditems[i] = string
if "type" in koditems == "episode":
if len("season" in koditems) == 1:
koditems["season"] = "S0" + koditems["season"]
else:
koditems["season"] = "S" + koditems["season"]
if len(koditems["episode"]) == 1:
koditems["episode"] = "E0" + koditems["episode"]
else:
koditems["episode"] = "E" + koditems["episode"]
if "type" in koditems:
test = self.Suchen_nach("label", a)
if koditems["type"] =="unknown" and test !="":
koditems["type"]="Stream"
return koditems
items = {"episode": "","width": "","duration":"","type":""}
sz = kodi("10.0.1.101")
wz = kodi("10.0.1.102")
print(sz.kodiitem())
print(sz.JSON_holen)
print(wz.kodiitem())
print(wz.JSON_holen)

View file

@ -1,68 +0,0 @@
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
import os
pfad = os.path.dirname(__file__)
def Nachricht(fradress, toadress, bccs, sub, attach):
fromaddr = fradress
toaddr = toadress
fobj = open(pfad + "/mpg/pass.txt")
passw = []
for line in fobj:
a = line.rstrip()
passw.append(a)
fobj.close()
pwd = passw[0]
msg = MIMEMultipart()
msg['From'] = fromaddr
msg['To'] = toaddr
msg['Subject'] = sub
body = 'Hello World again and again and again'
msg.attach(MIMEText(body, 'plain'))
for each in attach:
filename = each
attachment = open(pfad + '/mpg/'+each, 'rb')
part = MIMEBase('application', 'octet-stream')
part.set_payload((attachment).read())
encoders.encode_base64(part)
part.add_header('Content-Disposition', 'attachment; filename= %s' % filename)
msg.attach(part)
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login(fromaddr, pwd)
text = msg.as_string()
server.sendmail(fromaddr, bccs, text)
server.quit()
return
fradress='carsten.richter77@gmail.com'
toadress='carsten.richter77@gmail.com'
sub='das ist der finale Standalonetest'
anhang = ['adressen.txt','heute.pdf']
fobj = open(pfad + "/mpg/adressen.txt")
bcc = []
for line in fobj:
a = line.rstrip()
bcc.append(a)
fobj.close()
Nachricht (fradress,toadress,bcc,sub,anhang)

View file

@ -1,160 +0,0 @@
import pymysql
import bs4 as bs
import requests
import time
connection = pymysql.connect(db="hubobel",
user="hubobel",
passwd="polier2003",
host='10.0.1.123',charset='utf8')
cursor = connection.cursor()
requests.packages.urllib3.disable_warnings()
sauce = requests.get('https://lotto.web.de/webshop/product/eurojackpot/result', verify=False)
soup = bs.BeautifulSoup(sauce.text, 'lxml')
#print(soup)
ZahlenEuro = {'Datum': '', 'Z1': '', 'Z2': '', 'Z3': '', 'Z4': '', 'Z5': '', 'Eurozahl1': '', 'Eurozahl2': ''}
a = 1
daten = soup.find_all('div', class_="winning-numbers__number")
for i in daten:
#print(i.text)
if a <= 5:
ZahlenEuro['Z' + str(a)] = int(i.text)
elif a == 6:
ZahlenEuro['Eurozahl1'] = int(i.text)
elif a == 7:
ZahlenEuro['Eurozahl2'] = int(i.text)
a = a + 1
#print(ZahlenEuro)
daten = soup.find_all('h2', class_="strong hidden-xs")
#print(daten)
for i in daten:
date = i.text
date = date.replace(' ', '')
date = date.replace('\n', '')
start = (date.find('dem')) + 4
ende = (date.find('(Alle'))
ZahlenEuro['Datum'] = date[start:ende]
#print(ZahlenEuro)
requests.packages.urllib3.disable_warnings()
sauce = requests.get('https://lotto.web.de/webshop/product/lottonormal/result', verify=False)
soup = bs.BeautifulSoup(sauce.text, 'lxml')
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]
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:
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)""")
except:
None
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['Z4']) + "','" + str(data['Z5']) + "','" + str(data['Z6']) + "','" + str(data['Superzahl']) + \
"','" + str(data['Super6']) + "','" + str(data['Spiel77']) + "')"
sql_q = "SELECT * FROM samstag WHERE datum like '%" + data['Datum'] + "%'"
resp = cursor.execute(sql_q)
if resp == 0:
cursor.execute(sql)
connection.commit()
if "Mittwoch," in date:
try:
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)""")
except:
None
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()
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()
connection.close()
tag=int((time.strftime("%w")))
if tag != 5:
print(Lottozahlen)
elif tag == 7:
print(ZahlenEuro)
print(ZahlenEuro)

View file

@ -1,116 +0,0 @@
import pymysql
import bs4 as bs
import requests
import time
requests.packages.urllib3.disable_warnings()
sauce = requests.get('https://www.lotto-hessen.de/lotto6aus49/gewinnzahlen-quoten/gewinnzahlen', verify=False)
soup = bs.BeautifulSoup(sauce.text, 'lxml')
print(soup)
Lottozahlen = {'Datum': '', 'Z1': '', 'Z2': '', 'Z3': '', 'Z4': '', 'Z5': '', 'Z6': '', 'Superzahl': '',
'Spiel77': '', 'Super6': ''}
a = 0
daten = soup.find_all('span')
zahlen = []
for i in daten:
if a >= 1 and a < 7:
Lottozahlen['Z' + str(a)] = i.text
if a == 7:
Lottozahlen['Superzahl'] = i.text
a = a + 1
if i.text == 'Tag':
a = 1
for i in daten:
if a > 0 and a < 8:
Lottozahlen['Spiel77'] = Lottozahlen['Spiel77']+i.text
if a > 7 and a < 14:
Lottozahlen['Super6'] = Lottozahlen['Super6']+i.text
a = a +1
if i.text == 'Superzahl':
a = 1
daten = soup.find_all('h2', class_="h4")
for i in daten:
Lottozahlen['Datum']=i.text
a=1
while a < 7:
Lottozahlen['Z' + str(a)] = int(Lottozahlen['Z'+str(a)])
a = a + 1
Lottozahlen['Superzahl'] = int(Lottozahlen['Superzahl'])
Lottozahlen['Spiel77'] = int(Lottozahlen['Spiel77'])
Lottozahlen['Super6'] = int(Lottozahlen['Super6'])
datum = Lottozahlen['Datum']
start = datum.find(', ')
Lottozahlen['Datum'] = datum[start+2:]
print(Lottozahlen)
requests.packages.urllib3.disable_warnings()
sauce = requests.get('https://www.lotto-hessen.de/eurojackpot/gewinnzahlen-quoten/gewinnzahlen?gbn=5', verify=False)
soup = bs.BeautifulSoup(sauce.text, 'lxml')
ZahlenEuro = {'Datum': '', 'Z1': '', 'Z2': '', 'Z3': '', 'Z4': '', 'Z5': '', 'Eurozahl1': '', 'Eurozahl2': ''}
daten = soup.find_all('span')
for i in daten:
if i.text =='Tag':
a = -1
a = a + 1
if a >= 1 and a < 6:
ZahlenEuro['Z'+str(a)] = int(i.text)
if a == 6:
ZahlenEuro['Eurozahl1'] = int(i.text)
if a == 7:
ZahlenEuro['Eurozahl2'] = int(i.text)
daten = soup.find_all('h2', class_="h4")
for i in daten:
ZahlenEuro['Datum'] = i.text
datums = ZahlenEuro['Datum']
start = datums.find(', ')
ZahlenEuro['Datum'] = datums[start+2:]
print(ZahlenEuro)
connection = pymysql.connect(db="hubobel",
user="hubobel",
passwd="polier2003",
host='10.0.1.123',charset='utf8')
cursor = connection.cursor()
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 datum:
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['Z4']) + "','" + str(data['Z5']) + "','" + str(data['Z6']) + "','" + str(data['Superzahl']) + \
"','" + str(data['Super6']) + "','" + str(data['Spiel77']) + "')"
sql_q = "SELECT * FROM samstag WHERE datum like '%" + data['Datum'] + "%'"
resp = cursor.execute(sql_q)
if resp == 0:
cursor.execute(sql)
if 'Mittwoch,' in datum:
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)
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()

189
Mail.py
View file

@ -1,189 +0,0 @@
import requests
import json
import time
import datetime
import os
pfad = os.path.dirname(__file__)
url_ferien ='http://api.smartnoob.de/ferien/v1/ferien/?bundesland=rp'
url_feiertage = 'http://api.smartnoob.de/ferien/v1/feiertage/?bundesland=rp'
jetzt = int(time.strftime('%j'))
tag = time.strftime('%d')
ferien = False
ferien_morgen = False
feiertag = False
feiertag_morgen = False
if os.path.isdir(pfad+'/mpg')!= True: #prüfen, ob das UNTERverzeichniss /mpg bereits existiert
os.makedirs(pfad+'/mpg')
print ('Downloadverzeichniss bei '+pfad +' /mpg/ created!!!')
if int(tag) == 1: #Update einmal pro Monat
print("It´s Update Time!!!")
resp_ferien = requests.get(url_ferien)
resp_feiertage = requests.get(url_feiertage)
data_ferien = resp_ferien.json()
data_feiertage = resp_feiertage.json()
with open(pfad + '/mpg/json_ferien.data', 'w') as outfile:
json.dump(data_ferien, outfile)
with open(pfad + '/mpg/json_feiertage.data', 'w') as outfile:
json.dump(data_feiertage, outfile)
if os.path.isfile(pfad+'/mpg/json_ferien.data')!= True: #Download der jsons, falls diese lokal nicht existieren
print('The json_xxx.datas not found, will try to download them from the API')
resp_ferien = requests.get(url_ferien)
resp_feiertage = requests.get(url_feiertage)
data_ferien = resp_ferien.json()
data_feiertage = resp_feiertage.json()
with open(pfad+'/mpg/json_ferien.data','w') as outfile:
json.dump(data_ferien, outfile)
with open(pfad+'/mpg/json_feiertage.data','w') as outfile:
json.dump(data_feiertage, outfile)
with open(pfad+'/mpg/json_ferien.data') as file:
data_ferien=json.load(file)
with open(pfad+'/mpg/json_feiertage.data') as file:
data_feiertage=json.load(file)
a= len(data_ferien['daten'])
x = 0
while x <a:
beginn = data_ferien['daten'][x]['beginn']
beginn = datetime.datetime.fromtimestamp(beginn)
beginn = int(beginn.strftime('%j'))
ende = data_ferien['daten'][x]['ende']
ende = datetime.datetime.fromtimestamp(ende)
ende = int(ende.strftime('%j'))-1
if jetzt <= ende and jetzt >= beginn:
ferien = True
ferien_morgen = True
if jetzt-1 == beginn:
ferien_morgen = True
x = x+1
a= len(data_feiertage['daten'])
x = 0
while x <a:
beginn = data_feiertage['daten'][x]['beginn']
beginn = datetime.datetime.fromtimestamp(beginn)
beginn = int(beginn.strftime('%j'))
ende = data_feiertage['daten'][x]['ende']
ende = datetime.datetime.fromtimestamp(ende)
ende = int(ende.strftime('%j'))-1
if jetzt <= ende and jetzt >= beginn:
feiertag = True
if jetzt-1 == beginn:
feiertag_morgen = True
x = x+1
print('Es sind Ferien: '+ str(ferien))
print('Es sind morgen Ferien: '+ str(ferien_morgen))
print('Es ist ein Feiertag: '+str(feiertag))
print('Es ist morgen ein Feiertag: '+str(feiertag_morgen))
feiertag=False
feiertag_morgen=False
ferien_morgen=False
ferien=False
############################################################
if ferien or ferien_morgen:
quit()
if feiertag or feiertag_morgen:
quit()
def download(url):
#return None
filename = pfad+'/mpg/'+url+'.pdf'
url = 'http://www.mpglu.de/vps/'+url+'.pdf'
req = requests.get(url, auth=('schueler', 'Ing8gresk'))
file = open(filename, 'wb')
for chunk in req.iter_content(100000):
file.write(chunk)
file.close()
return None
def modification_date(filename):
t = os.path.getmtime(filename)
return datetime.datetime.fromtimestamp(t)
try:
os.rename(pfad + '/mpg/heute.pdf', pfad +'/mpg/heute1.pdf')
url = 'heute'
download(url)
x = os.stat(pfad+'/mpg/heute.pdf')
x = x.st_size
x1 = str(x)
y = os.stat(pfad+'/mpg/heute1.pdf')
y = y.st_size
y1 = str(y)
mail = 0
if x != y:
mail=mail+1
else:
print("Es gibt keine neuen Mals mit 'heute'")
d = modification_date(pfad+'/mpg/heute.pdf')
d = d.strftime('%H:%M:%S')
print("heute: " + d + ' '+ x1 + ' Bytes')
d = modification_date(pfad+'/mpg/heute1.pdf')
d = d.strftime('%H:%M:%S')
print("heute1: " + d + ' '+ y1 + ' Bytes')
except FileNotFoundError:
print("File Heute.PDF not found")
print("Will try to download it from the MPG-Server")
url = 'heute'
download(url)
try:
os.rename(pfad+'/mpg/morgen.pdf', pfad+'/mpg/morgen1.pdf')
url = 'morgen'
download(url)
x = os.stat(pfad+'/mpg/morgen.pdf')
x = x.st_size
x1 = str(x)
y = os.stat(pfad+'/mpg/morgen1.pdf')
y = y.st_size
y1 = str(y)
if x != y:
mail = mail + 2
else:
print("Es gibt keine neuen Mails mit 'morgen'")
d= modification_date(pfad+'/mpg/morgen.pdf')
d = d.strftime('%H:%M:%S')
print("morgen: " + d + ' ' + x1 + ' Bytes')
d = modification_date(pfad+'/mpg/morgen1.pdf')
d = d.strftime('%H:%M:%S')
print("morgen1: " + d + ' ' + x1 + ' Bytes')
except FileNotFoundError:
print("File Morgen.PDF not found")
print("Will try to download it from the MPG-Server")
url = 'morgen'
download(url)
if mail == 1:
befehl = 's-nail -a ' + pfad + '/mpg/heute.pdf -s "Heute-MPG-Vertretungsliste" schneeschieben@web.de'
os.system(befehl)
if mail == 2:
befehl = 's-nail -a ' + pfad + '/mpg/morgen.pdf -s "Morgen-MPG-Vertretungsliste" schneeschieben@web.de'
os.system(befehl)
if mail == 3:
befehl = 's-nail -a ' + pfad + '/mpg/heute.pdf -a ' + pfad + '/mpg/morgen.pdf -s "Alpha-MPG-Vertretungsliste" schneeschieben@web.de'
os.system(befehl)

Binary file not shown.

View file

@ -1,37 +0,0 @@
import requests
import telebot
TOKEN='680737840:AAEaa7Vxl_kZz_LWS1_S-lH6Eda7HXqu6Y4'
ChatID='322673713'
tb = telebot.TeleBot(TOKEN)
url_zitat = 'https://dbf.finalrewind.org/mainzhbf.json?version=3'
resp_zitat = requests.get(url_zitat)
data_zitat = resp_zitat.json()
#print (data_zitat)
antwort=''
telegramm='Mainz - Alzey\n'
for i in data_zitat['departures']:
#print(i)
if i['train'] == "RE 13":
if i['delayDeparture'] != None:
#print(i)
antwort=(i['train']+' '+i['platform'] +' '+ str(i['scheduledDeparture']))
if i['delayDeparture'] != 0:
antwort = antwort + (' Verspätung: ' + str(i['delayDeparture']))
else:
antwort = antwort +' PÜNKTLICH'
telegramm = telegramm + antwort + '\n'
if i['train'] == "RB 31":
if i['delayDeparture'] != None:
#print(i)
antwort=(i['train']+' '+i['platform'] +' '+ str(i['scheduledDeparture']))
if i['delayDeparture'] != 0:
antwort = antwort + (' Verspätung: ' + str(i['delayDeparture']))
else:
antwort = antwort +' PÜNKTLICH'
telegramm = telegramm+antwort+'\n'
#print(telegramm)
tb.send_message(ChatID,telegramm)

View file

@ -1,16 +0,0 @@
import requests
import telebot
TOKEN='680737840:AAEaa7Vxl_kZz_LWS1_S-lH6Eda7HXqu6Y4'
ChatID='322673713'
tb = telebot.TeleBot(TOKEN)
url_zitat = 'https://dbf.finalrewind.org/mainzhbf.json?version=3'
resp_zitat = requests.get(url_zitat)
data_zitat = resp_zitat.json()
#print (data_zitat)
antwort=''
telegramm='Mainz - Wiesbaden\n'
for i in data_zitat['departures']:
print(i)

View file

@ -1,23 +0,0 @@
import os
from datetime import datetime
pfad = os.getcwd() + "/Ziel/"
content = (os.listdir(pfad))
jetzt = datetime.now()
diff_seconds = (jetzt-datetime.fromtimestamp(0)).total_seconds()
jetzt = datetime.fromtimestamp(0)
for i in content:
datum = (os.path.getmtime(pfad + i))
alter = (diff_seconds-datum)/60/60/24
if i[:1] == "(":
b = i.find(')')
dauer = int((i[1:b]))-int(alter)
print(i + ' wird in ' + str(dauer) + ' Tagen gelöscht')
if dauer < 1:
os.remove(pfad+i)
print(i + ' wurde gelöscht!')
elif alter > 14:
os.remove(pfad + i)
print(i + ' wurde gelöscht!')

View file

@ -1,84 +1,36 @@
import urllib.request import urllib.request
import time import re
ip = "10.0.1.100" def kodi(suchstring):
SV = "xyz"
lauf = 1
urlREF = ""
def kodi(suchstring, a): url = "http://10.0.1.102/jsonrpc?request=%7B%22jsonrpc%22:%20%222.0%22,%20%22method%22:%20%22Player.GetItem%22,%20%22params%22:%20%7B%20%22properties%22:%20%5B%22title%22,%20%22album%22,%20%22artist%22,%20%22season%22,%20%22episode%22,%20%22duration%22,%20%22showtitle%22,%20%22tvshowid%22,%20%22thumbnail%22,%20%22file%22,%20%22fanart%22,%20%22streamdetails%22%5D,%20%22playerid%22:%201%20%7D,%20%22id%22:%20%22VideoGetItem%22%7D"
start = len(suchstring) + 3 # berechnet die Anfangsposition des Wertes
ende = len(a) # gibt die Gesamtlänge der URL Antwort an
position = a.find("\"" + suchstring, 46,
ende) # sucht in der gesamten URL Antwort nach dem Suchbegriff und ermittelt dessen Position im String (Anfang)
if position > 0:
position2 = a.find(",\"", position,
ende) # sucht anhand der Anfangspos. des Suchstrings nach dem Ende des dazugehörigen Wertes (endet mit ,")
wert = (a[position + start:position2]) # gibt den Wert des Suchbegriffes aus
x = 0
while wert.isalnum() is False and x < 2:
wert = wert.strip("\"}][{")
x = x + 1
return wert
return None
def kodiserie():
if koditems["type"] == "episode":
if len(koditems["season"]) == 1:
koditems["season"] = "S0" + koditems["season"]
else:
koditems["season"] = "S" + koditems["season"]
if len(koditems["episode"]) == 1:
koditems["episode"] = "E0" + koditems["episode"]
else:
koditems["episode"] = "E" + koditems["episode"]
elif koditems["type"] == "movie":
koditems["season"] = ""
koditems["episode"] = ""
elif koditems["type"] == "unknown":
koditems["season"] = ""
koditems["episode"] = ""
return
def kodiurl(url):
try:
antwort = urllib.request.urlopen(url) antwort = urllib.request.urlopen(url)
b=(antwort.read()) b=(antwort.read())
a = b.decode("utf-8") a = b.decode("utf-8")
return a
except:
return None
def ccuurl(url): #KODI aus:
try: #a = "{\"id\":\"VideoGetItem\",\"jsonrpc\":\"2.0\",\"result\":{\"item\":{\"album\":\"\",\"artist\":[],\"episode\":-1,\"fanart\":\"\",\"file\":\"\",\"label\":\"\",\"season\":-1,\"showtitle\":\"\",\"streamdetails\":{\"audio\":[],\"subtitle\":[],\"video\":[]},\"thumbnail\":\"\",\"title\":\"\",\"tvshowid\":-1,\"type\":\"unknown\"}}}"
urllib.request.urlopen(url) #KODI TV-Show:
except: #a = "{\"id\":\"VideoGetItem\",\"jsonrpc\":\"2.0\",\"result\":{\"item\":{\"album\":\"\",\"artist\":[],\"episode\":1,\"fanart\":\"image://http%3a%2f%2fthetvdb.com%2fbanners%2ffanart%2foriginal%2f81189-13.jpg/\",\"file\":\"nfs://10.0.1.30/mnt/2T/Serien/Breaking Bad/S01/Brak.Bad.s01e01.Der.Einstieg.Ger.AC51.DL.72p.BRay.x264-Kristallprinz.mp4\",\"id\":3466,\"label\":\"Der Einstieg\",\"season\":1,\"showtitle\":\"Breaking Bad\",\"streamdetails\":{\"audio\":[],\"subtitle\":[],\"video\":[]},\"thumbnail\":\"image://http%3a%2f%2fthetvdb.com%2fbanners%2fepisodes%2f81189%2f349232.jpg/\",\"title\":\"Der Einstieg\",\"tvshowid\":165,\"type\":\"episode\"}}}"
return #KODI Movie:
a = "{\"id\":\"VideoGetItem\",\"jsonrpc\":\"2.0\",\"result\":{\"item\":{\"album\":\"\",\"artist\":[],\"episode\":-1,\"fanart\":\"image://http%3a%2f%2fimage.tmdb.org%2ft%2fp%2foriginal%2fyIZ1xendyqKvY3FGeeUYUd5X9Mm.jpg/\",\"file\":\"nfs://10.0.1.30/mnt/2T/NFS_Filme/Arrival.2016.German.720p.BluRay.x264-DOUCEMENT/arrival.2016.german.720p.bluray.x264-doucement.mkv\",\"id\":389,\"label\":\"Arrival\",\"season\":-1,\"showtitle\":\"\",\"streamdetails\":{\"audio\":[{\"channels\":6,\"codec\":\"dca\",\"language\":\"ger\"}],\"subtitle\":[{\"language\":\"ger\"}],\"video\":[{\"aspect\":2.3880600929260253906,\"codec\":\"h264\",\"duration\":6991,\"height\":536,\"language\":\"eng\",\"stereomode\":\"\",\"width\":1280}]},\"thumbnail\":\"image://http%3a%2f%2fimage.tmdb.org%2ft%2fp%2foriginal%2fx9DnIgHVWbW3uIJIQ2KeqeW0n2u.jpg/\",\"title\":\"Arrival\",\"tvshowid\":-1,\"type\":\"movie\"}}}"
while lauf < 2:
koditems = {"episode": "", "fanart": "", "file": "", "label": "", "season": "", "showtitle": "", "type": "",
"title": "", "id": "", "width": ""}
url = "http://10.0.1.102/jsonrpc?request=%7B%22jsonrpc%22:%20%222.0%22,%20%22method%22:%20%22Player.GetItem%22,%20%22params%22:%20%7B%20%22properties%22:%20%5B%22title%22,%20%22album%22,%20%22artist%22,%20%22season%22,%20%22episode%22,%20%22duration%22,%20%22showtitle%22,%20%22tvshowid%22,%20%22thumbnail%22,%20%22file%22,%20%22fanart%22,%20%22streamdetails%22%5D,%20%22playerid%22:%201%20%7D,%20%22id%22:%20%22VideoGetItem%22%7D"
a=kodiurl(url) #Aufruf der url über eine Funktion um evtl Fehler abzufangen (Fehler = NONE)
#a='{"id":"VideoGetItem","jsonrpc":"2.0","result":{"item":{"album":"","artist":[],"episode":2,"fanart":"image://http%3a%2f%2fthetvdb.com%2fbanners%2ffanart%2foriginal%2f176941-3.jpg/","file":"nfs://10.0.1.30/mnt/2T/Serien/Sherlock/S04/zzgtv-sherlock-s04e02.mkv","id":3800,"label":"Der lügende Detektiv","season":4,"showtitle":"Sherlock","streamdetails":{"audio":[{"channels":6,"codec":"ac3","language":"ger"}],"subtitle":[],"video":[{"aspect":1.7777800559997558594,"codec":"h264","duration":5347,"height":720,"language":"","stereomode":"","width":1280}]},"thumbnail":"image://http%3a%2f%2fthetvdb.com%2fbanners%2fepisodes%2f176941%2f5776503.jpg/","title":"Der lügende Detektiv","tvshowid":127,"type":"episode"}}}' start = len(suchstring)+4 # berechnet die Anfangsposition des Wertes
ende = len(a) # gibt die Gesamtlänge der URL Antwort an
if a != None: position = a.find("\""+suchstring,0,ende) #sucht in der gesamten URL Antwort nach dem Suchbegriff und ermittelt dessen Position im String (Anfang)
for i in koditems: if position>0:
wert = kodi(i, a) position2 = a.find(",\"",position,ende) #sucht anhand der Anfangspos. des Suchstrings nach dem Ende des dazugehörigen Wertes (endet mit ,")
koditems[i] = wert if position2<0: #filter das Ende des JSON-Objektes heraus (kein ," mehr vorhanden)
kodiserie() position2 =ende-3
string = koditems["showtitle"] + " " + koditems["label"] + " " + koditems["season"] + koditems["episode"] wert = (a[position+start:position2-1]) #gibt den Wert des Suchbegriffes aus
string = string.replace("ä", "ae").replace("Ä", "Ae").replace("ö", "oe").replace("Ö", "oe").replace("ü", "ue").replace("Ü", "Ue").replace(" ", "_")
if string == "__":
string = ""
url = 'http://' + ip + ':8181/loksoft.exe?ret=dom.GetObject("' + SV + '").State("' + string + '")'
print(url)
if url != urlREF:
ccuurl(url) #Aufruf der url über eine Funktion um evtl Fehler abzufangen (Fehler = NONE)
urlREF = url
else: return (wert)
print("Fehler") return 0
time.sleep(10)
eingabe = input("was: ")
label = kodi(eingabe)
print(label)

View file

@ -1,50 +0,0 @@
from imap_tools import MailBox
import telebot
import os
import json
import sys
conf = os.path.basename(sys.argv[0])
conf = conf.replace(".py", ".conf")
absFilePath = os.path.abspath(__file__)
path, filename = os.path.split(absFilePath)
conf = path + '/' + conf
if os.path.isfile(conf) is False:
print(conf + ' scheint es nicht zu geben.')
print('Ich lege eine neue Datei '+ conf + ' an.')
passw={"mail_pass": "","mail_user": "",
"mail_host": "",
"mail_folder": "",
"Chat_ID": "","TOKEN": ""
}
print(str(conf)+ ' bitte entsprechend befüllen.')
with open(conf, 'w') as fp:
json.dump(passw, fp, sort_keys=True, indent=4)
quit()
else:
with open(conf) as file:
passw = json.load(file)
TOKEN = passw['TOKEN']
chat_id = passw['Chat_ID']
host = passw['mail_host']
username = passw['mail_user']
password = passw['mail_pass']
folder = passw['mail_folder']
tb = telebot.TeleBot(TOKEN)
with MailBox(host).login(username, password, folder) as mailbox:
anzahl = len(mailbox.numbers(criteria='UNSEEN'))
ankuendigung = 'Heute befinden sich ' + str(anzahl) + ' Sendungen auf dem Weg in die Hintergasse.'
tb.send_message(chat_id, ankuendigung)
for msg in mailbox.fetch(mark_seen=True,criteria='UNSEEN' ): #criteria='UNSEEN'
for att in msg.attachments:
fn = att.filename
ext = (att.content_type[-3:])
fn = str(msg.uid) + fn +'.'+ ext
with open(fn, 'wb') as f:
f.write(att.payload)
document = open(fn, 'rb')
tb.send_document(chat_id, document, caption=msg.date)
os.remove(fn)

View file

@ -1,125 +0,0 @@
from imbox import Imbox
import traceback
import os
import time
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
import sys
from datetime import datetime
import logging
import json
appname = os.path.basename(sys.argv[0])
appname = appname.replace(".py", ".conf")
absFilePath = os.path.abspath(__file__)
absFilePath = absFilePath.replace(".py", ".conf")
if os.path.isfile(absFilePath) is False:
print(appname + ' scheint es nicht zu geben.')
print('Ich lege eine neue Datei ' + appname + ' an.')
passw={'mail':
{
"mail_pass": "",
"mail_user": "",
"mail_host": "",
"mail_smtp": ""
}
}
print(str(appname) + ' bitte entsprechend befüllen.')
with open(absFilePath, 'w') as fp:
json.dump(passw, fp, sort_keys=True, indent=4)
quit()
else:
with open(absFilePath) as file:
passw = json.load(file)
print(passw)
if not os.path.exists('Post'):
os.makedirs('Post')
empfänger = sys.argv
if (len(empfänger)) != 2:
print('Geben Sie bitte GENAU EINEN Empfänger als Argument an!')
exit()
absFilePath = os.path.abspath(__file__)
path, filename = os.path.split(absFilePath)
host = passw['mail']['mail_host']
username = passw['mail']['mail_user']
password = passw['mail']['mail_pass']
smtpServer = passw['mail']['mail_smtp']
smtpPort = 587
sender = username
reciever = empfänger[1]
subject = "Hallo Welt!"
msg = MIMEMultipart()
msg['Subject'] = subject
msg['From'] = sender
msg['To'] = reciever
Log_Format = "%(levelname)s %(asctime)s - %(message)s"
logging.basicConfig(filename = path + "/printbring.log",
filemode = "a",
format = Log_Format,
level = logging.ERROR)
logger = logging.getLogger()
mail = Imbox(host, username=username, password=password, ssl=True, ssl_context=None, starttls=False)
messages = mail.messages(unread=True)
logger.setLevel(logging.INFO)
for (uid, message) in messages:
mail.mark_seen(uid) # optional, mark message as read
bodie = message.sent_from
body = 'von: ' + str(bodie[0]['name']) + ' über: '+ str(bodie[0]['email'])
body = body + ' mit dem Betreff: ' + message.subject
body = body + '\n'
body = body + 'Datum der ursprünglichen Nachricht: ' + message.date
body = body + '\n'
now = datetime.now()
dt_string = now.strftime("%d/%m/%Y %H:%M:%S")
body = body + 'Datum der Jobverarbeitung: ' + dt_string
#print(body)
for idx, attachment in enumerate(message.attachments):
try:
name = time.time()
fn = attachment.get('filename')
root, extension = os.path.splitext(fn)
att_fn = str(name)+str(extension)
print(att_fn)
with open('Post/' + att_fn, "wb") as fp:
fp.write(attachment.get('content').read())
msg = MIMEMultipart()
msg.attach(MIMEText(body, 'plain'))
filename = att_fn
attachment = open('Post/'+filename, 'rb')
part = MIMEBase('application', 'octet-stream')
part.set_payload((attachment).read())
encoders.encode_base64(part)
part.add_header('Content-Disposition', 'attachment; filename= %s' % att_fn)
msg.attach(part)
server = smtplib.SMTP(smtpServer, 587)
server.starttls()
server.login(username, password)
msg['Subject'] = str(fn) + ' to ' + str(name)
text = msg.as_string()
server.sendmail(username, reciever, text)
server.quit()
logger.info(msg['Subject'])
except:
print(traceback.print_exc())
logger.error(traceback.print_exc())
mail.delete(uid)
for filename in os.listdir('Post'):
os.remove('Post/'+filename)
logger.setLevel(logging.ERROR)
mail.logout()

View file

@ -1,9 +0,0 @@
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'])

View file

@ -1,4 +0,0 @@
# mrRSS
ein RSS Reader
es folgt bald mehr

View file

@ -1,58 +0,0 @@
# mpgScanner
holt die Vertretungspläne vom Schulserver und verschickt diese, sollten Aktualisierungen vorliegen, dann per Mail und/oder Telegram-Messenger an beliebige viele
Empfänger (via Blindcopy, BCC),in Abhänigkeit davon, ob gerade Ferien oder ein Feiertag sind.
Für Nutzer der Hausautomation "Homematic": Es wird eine Systemvariable "Ferien" automatisch auf "True" bzw "False" gesetzt, wenn man dies möchte.
Zusätzlich werden einmal pro Tag ein "Zitat des Tages" angegeben.
Beim Versand der PDF werden die jeweils aktuelle Temperatur,Luftfeuchte und der Wolkenstatus mitangegeben. Ein zufällig ausgewählter "Chuck-Norris-Fact" runden das ganze dann ab.
# Installation
Das File downloaden und in einen beliebigen Ordner, in welchem man natürlich Schreibrechte besitzen muss, stecken.
Nach dem ersten Start wird automatisch eine Datei pass.json im gleichen Verzeichniss erstellt und die Anwendung beendet sich selbst.
Nun müssen folgende Angaben innerhalb dieser 'pass.json' gemacht werden:
* "gmail_pass":Passwort für den eigenen G-Mail Account (wird zum Versenden der PDF´s benötigt)
* "gmail_user":eigene Emailadresse des für die versendung zuständigen Accounts
* "Land":Europäisches Kürzel für den eignen Wohnort (z.Bsp. RP für RheinlandPfalz)
* "TOKEN":der Usertoken des Telegrammessengers (optional)
* "Chat_ID":Chat_ID des Telegrammessengers (optional)
* "ccu_ip":IP der CCU-Zentrale der Hausautomation 'Homematic' (optional)
* "wetter_API": der API-Key von wunderground.com
* "wetter_Ort": die ID der verwendeten Wetterstation
Weiterhin muss auf dem ausführenden System die Pythonbiliothek "pyTelegramBotAPI" installiert sein (wenn man Telegram nutzen möchte, sonst wird diese Funktion automatisch deaktiviert:
* sollte pip noch nicht installiert sein: "sudo apt-get installe python3-pip"
* pip3 install pyTelegramBotAPI
Bsp. für eine leere pass.json, wie sie automatisch nach dem ersten Start angelegt wird:
{
"Chat_ID": "",
"Land": "rp",
"TOKEN": "",
"ccu_ip": "",
"gmail_pass": "",
"gmail_user": "",
"mpg_pass": "",
"mpg_user": ""
}
# Benutzung
Das Programm wird am besten über einen Cronjob periodisch aufgerufen, z.Bsp. Stündlich, immer zur halben Stunde, im Zeitraum von 7 bis 15 Uhr, an den Werk(Schul-)tagen Montag bis Freitag.
Eintrag in der crontab sollte dann in etwa so ausschauen (Pfad zum Script bitte anpassen):
30 7-15 * * 1-5 python3 /home/carsten/Scripts/mpgScanner.py
# Disclaimer
Diese Software benutz den Zugang zum Schulserver des Max-Planck-Gymnasiums in Ludwigshafen (http://www.mpglu.de/aktuelles/vertretungsplan.html), um dort die Vertretungspläne für den aktuellen und den darauf folgenden Schultag zu laden. Für die Feier- und Ferientagsdaten wird die API von smartnoob.de (https://robin.meis.space/2014/04/15/ferien-feiertag-api-fuer-deutschland/) benutz. Vielen Dank für die Bereitstellung der Daten.
Für das "Zitat des Tages Feature" nutze ich die API von https://taeglicheszit.at
Um die aktuelle Temperatur/Luftfeuchtigkeit und "Bedeckung" anzuzeigen, greife ich auf die API von http://www.wunderground.com zurück.
Der Chuck-Norris-Fact wird von meiner eigenen API (api.hubobel.de/facts) bereitgestellt.
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.me/Hubobel)

View file

@ -1,98 +0,0 @@
[2017-Nov-11 18:32] 127.0.0.1 GET http /facts/9999? 200 OK
[2017-Nov-11 18:32] 127.0.0.1 GET http /facts? 200 OK
[2017-Nov-11 18:34] 127.0.0.1 GET http /? 200 OK
[2017-Nov-11 18:38] 127.0.0.1 GET http /? 200 OK
[2017-Nov-11 18:38] 127.0.0.1 GET http /? 200 OK
[2017-Nov-11 18:38] 127.0.0.1 GET http /? 200 OK
[2017-Nov-11 18:38] 127.0.0.1 GET http /facts? 200 OK
[2017-Nov-11 18:38] 127.0.0.1 GET http /facts/? 404 NOT FOUND
[2017-Nov-11 18:38] 127.0.0.1 GET http /facts/12? 200 OK
[2017-Nov-11 18:38] 127.0.0.1 GET http /facts/12? 200 OK
[2017-Nov-11 18:38] 127.0.0.1 GET http /facts/12? 200 OK
[2017-Nov-11 18:38] 127.0.0.1 GET http /facts/? 404 NOT FOUND
[2017-Nov-11 18:42] 127.0.0.1 GET http /facts/? 404 NOT FOUND
[2017-Nov-11 18:42] 127.0.0.1 GET http /facts? 200 OK
[2017-Nov-11 18:42] 127.0.0.1 GET http /? 200 OK
[2017-Nov-11 18:42] 127.0.0.1 GET http /? 200 OK
[2017-Nov-11 18:42] 127.0.0.1 GET http /? 200 OK
[2017-Nov-11 18:42] 127.0.0.1 GET http /facts? 200 OK
[2017-Nov-11 18:42] 127.0.0.1 GET http /facts? 200 OK
[2017-Nov-11 18:42] 127.0.0.1 GET http /facts/? 404 NOT FOUND
[2017-Nov-11 18:43] 127.0.0.1 GET http /facts/12? 200 OK
[2017-Nov-11 18:44] 127.0.0.1 GET http /facts/12? 200 OK
[2017-Nov-11 18:45] 127.0.0.1 GET http /facts/12? 200 OK
[2017-Nov-11 18:45] 127.0.0.1 GET http /facts/12? 200 OK
[2017-Nov-11 18:45] 127.0.0.1 GET http /facts/13? 200 OK
[2017-Nov-11 18:45] 127.0.0.1 GET http /facts/? 404 NOT FOUND
[2017-Nov-11 18:46] 127.0.0.1 GET http /facts/9999? 200 OK
[2017-Nov-11 18:46] 127.0.0.1 GET http /facts/9999? 200 OK
[2017-Nov-11 18:46] 127.0.0.1 GET http /facts/? 404 NOT FOUND
[2017-Nov-11 18:46] 127.0.0.1 GET http /facts/10? 200 OK
[2017-Nov-11 18:46] 127.0.0.1 GET http /facts/10? 200 OK
[2017-Nov-11 18:46] 127.0.0.1 GET http /facts/? 404 NOT FOUND
[2017-Nov-11 18:46] 127.0.0.1 GET http /facts/85? 200 OK
[2017-Nov-11 18:46] 127.0.0.1 GET http /facts/89? 200 OK
[2017-Nov-11 18:47] 127.0.0.1 GET http /facts/? 404 NOT FOUND
[2017-Nov-11 18:47] 127.0.0.1 GET http /facts/9999? 200 OK
[2017-Nov-11 18:47] 127.0.0.1 GET http /facts/9999? 200 OK
[2017-Nov-11 18:47] 127.0.0.1 GET http /facts/9999? 200 OK
[2017-Nov-11 18:47] 127.0.0.1 GET http /facts/9999? 200 OK
[2017-Nov-11 18:47] 127.0.0.1 GET http /facts/9999? 200 OK
[2017-Nov-11 18:47] 127.0.0.1 GET http /facts/? 404 NOT FOUND
[2017-Nov-11 18:47] 127.0.0.1 GET http /facts? 200 OK
[2017-Nov-11 18:47] 127.0.0.1 GET http /? 200 OK
[2017-Nov-11 18:47] 127.0.0.1 GET http /? 200 OK
[2017-Nov-11 21:48] 81.169.144.135 GET http /facts/9999? 200 OK[2017-Nov-12 10:30] 127.0.0.1 GET http /? 200 OK
[2017-Nov-12 10:31] 127.0.0.1 GET http /? 200 OK
[2017-Nov-12 10:31] 127.0.0.1 GET http /? 200 OK
[2017-Nov-12 10:31] 127.0.0.1 GET http /? 200 OK
[2017-Nov-14 17:16] 127.0.0.1 GET http /? 200 OK
[2017-Nov-14 17:16] 127.0.0.1 GET http /? 200 OK
[2017-Nov-14 17:16] 127.0.0.1 GET http /facts? 200 OK
[2017-Nov-14 17:16] 127.0.0.1 GET http /facts? 200 OK
[2017-Nov-14 17:17] 127.0.0.1 GET http /facts/? 404 NOT FOUND
[2017-Nov-14 17:17] 127.0.0.1 GET http /facts/9999? 200 OK
[2017-Nov-14 17:17] 127.0.0.1 GET http /facts/9999? 200 OK
[2017-Nov-14 17:17] 127.0.0.1 GET http /facts/9999? 200 OK
[2017-Nov-14 17:17] 127.0.0.1 GET http /facts/9999? 200 OK
[2017-Nov-14 17:17] 127.0.0.1 GET http /facts/9999? 200 OK
[2017-Nov-14 17:18] 127.0.0.1 GET http /facts/9999? 200 OK
[2017-Nov-14 17:18] 127.0.0.1 GET http /facts/9999? 200 OK
[2017-Nov-14 17:18] 127.0.0.1 GET http /facts/9999? 200 OK
[2017-Nov-14 17:18] 127.0.0.1 GET http /facts/9999? 200 OK
[2017-Nov-14 17:18] 127.0.0.1 GET http /facts/9999? 200 OK
[2017-Nov-14 17:19] 127.0.0.1 GET http /facts/9999? 200 OK
[2017-Nov-14 17:19] 127.0.0.1 GET http /facts/9999? 200 OK
[2017-Nov-14 17:24] 127.0.0.1 GET http /facts/9999? 200 OK
[2017-Nov-14 17:24] 127.0.0.1 GET http /facts/? 404 NOT FOUND
[2017-Nov-14 17:24] 127.0.0.1 GET http /facts/10? 200 OK
[2017-Nov-14 17:24] 127.0.0.1 GET http /facts/10? 200 OK
[2017-Nov-14 17:25] 127.0.0.1 GET http /facts/10? 200 OK
[2017-Nov-14 17:25] 127.0.0.1 GET http /facts/12? 200 OK
[2017-Nov-14 17:25] 127.0.0.1 GET http /facts/12? 200 OK
[2017-Nov-14 17:25] 127.0.0.1 GET http /facts/12? 200 OK
[2017-Nov-14 17:25] 127.0.0.1 GET http /facts/? 404 NOT FOUND
[2017-Nov-14 17:25] 127.0.0.1 GET http /facts/9999? 200 OK
[2017-Nov-14 17:25] 127.0.0.1 GET http /facts/9999? 200 OK
[2017-Nov-14 17:25] 127.0.0.1 GET http /facts/9999? 200 OK
[2017-Nov-14 17:25] 127.0.0.1 GET http /facts/? 404 NOT FOUND
[2017-Nov-14 17:25] 127.0.0.1 GET http /facts/89? 200 OK
[2017-Nov-14 17:25] 127.0.0.1 GET http /facts/86? 200 OK
[2017-Nov-14 17:33] 127.0.0.1 GET http /facts? 200 OK
[2017-Nov-14 17:33] 127.0.0.1 GET http /facts? 200 OK
[2017-Nov-14 17:34] 127.0.0.1 GET http /facts/? 404 NOT FOUND
[2017-Nov-14 17:34] 127.0.0.1 GET http /facts/15? 200 OK
[2017-Nov-14 17:34] 127.0.0.1 GET http /facts/15? 200 OK
[2017-Nov-14 17:55] 127.0.0.1 GET http /? 200 OK
[2017-Nov-14 17:55] 127.0.0.1 GET http /facts? 200 OK
[2017-Nov-14 17:55] 127.0.0.1 GET http /facts? 200 OK
[2017-Nov-14 17:55] 127.0.0.1 GET http /facts/? 404 NOT FOUND
[2017-Nov-14 17:55] 127.0.0.1 GET http /facts/12? 200 OK
[2017-Nov-14 17:55] 127.0.0.1 GET http /facts/19? 200 OK
[2017-Nov-14 18:43] 127.0.0.1 GET http /facts/19? 200 OK
[2017-Nov-14 18:43] 127.0.0.1 GET http /facts/? 404 NOT FOUND
[2017-Nov-14 18:43] 127.0.0.1 GET http /facts? 200 OK
[2017-Nov-14 18:44] 127.0.0.1 GET http /? 200 OK
[2017-Nov-14 18:44] 127.0.0.1 GET http /? 200 OK
[2017-Nov-14 18:45] 127.0.0.1 GET http /? 200 OK
[2017-Nov-14 18:46] 127.0.0.1 GET http /? 200 OK

View file

@ -1,66 +0,0 @@
import os
import random
from flask import Flask, jsonify
import bs4 as bs
import urllib.request
app = Flask(__name__)
fact=[]
pfad = os.path.dirname(__file__)
chuck_file= open(pfad + '/mpg/chuck.rtf','r')
for line in chuck_file:
fact.append(line)
chuck_file.close()
ran=random.randint(1,len(fact)-1)
fakt={}
a=0
for i in fact:
fakt[a]=i
a =a +1
@app.route('/')
def index():
return "Hello, World!"
@app.route('/facts', methods=['GET'])
def get_tasks():
return jsonify({'facts': fakt})
@app.route('/lotto', methods=['GET'])
def get_lotto():
sauce = urllib.request.urlopen('http://www.lottotip-check.de').read()
soup = bs.BeautifulSoup(sauce, 'html.parser')
table = soup.find_all('table')
row = []
test = []
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(sz)
date = 'Ziehung vom: ' + str(sz[0])
sz = 'Superzahl: ' + str(sz[1])
row.append(sz)
row.insert(0, date)
test.extend(row)
test[14] = 'Superzahl: ' + test[14]
test = test[0:24]
Mit = {test[0]: test[1:8]}
EUR = {test[8]: test[9:16]}
Sam = {test[16]: test[17:24]}
return jsonify(test)
@app.route('/facts/<int:task_id>', methods=['GET'])
def get_task(task_id):
if len(fact)-1<task_id:
return jsonify({'error':"Auch Chuck Norris Witze sind begrenzt"})
return jsonify({'fact': fact[task_id]})
if __name__ == '__main__':
app.run(host='0.0.0.0')

View file

@ -1,685 +0,0 @@
import random
from flask import Flask, jsonify, make_response
from flask import request, send_file
import pymysql
import bs4 as bs
import requests as req
import datetime
from selenium import webdriver
from time import sleep
from selenium.webdriver.chrome.options import Options
import time
import json
app = Flask(__name__)
def Update():
connection = pymysql.connect(db="hubobel",
user="hubobel",
passwd="polier2003",
host='10.0.1.59', charset='utf8')
cursor = connection.cursor()
sql = "SELECT * FROM facts"
resp = cursor.execute(sql)
x = cursor.fetchall()
fact = dict(x)
cursor.close()
connection.close()
a = len(fact)
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.sachsenlotto.de/portal/zahlen-quoten/gewinnzahlen/eurojackpot-gewinnzahlen/eurojackpot-gewinnzahlen.jsp',
verify=False)
soup = bs.BeautifulSoup(sauce.text, 'lxml')
zahlen = []
ergebniss = []
ZahlenEuro = {'Datum': '', 'Z1': '', 'Z2': '', 'Z3': '', 'Z4': '', 'Z5': '', 'Eurozahl1': '', 'Eurozahl2': ''}
a = 1
source = soup.find_all('span',
class_='sl-statistic-number-circle-container-filled col-lg-1 col-md-1 col-sm-1 col-xs-1')
for i in source:
zahlen.append(i.text)
while a <= 5:
ZahlenEuro['Z' + str(a)] = int(zahlen[a - 1])
a += 1
ZahlenEuro['Eurozahl1'] = zahlen[5]
ZahlenEuro['Eurozahl2'] = zahlen[6]
print(ZahlenEuro)
source = soup.find_all('h3', style='color: white')
for i in source:
datum = i.text
start = (datum.find('Freitag,')) + 9
ZahlenEuro['Datum'] = datum[start:]
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
def TV(mode):
if mode == 0:
mode = 'jetzt'
range = 7
if mode == 1:
mode = 'abends'
range = 7
if mode == 2:
mode = 'fernsehprogramm-nachts'
range = 7
if mode == 3:
mode = 'jetzt'
range = 1
Sendungen = {}
x = 1
while x <= range:
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['Senderliste'] = liste
return Sendungen
@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)
def not_found(error):
return make_response(jsonify({'error': 'Nicht unterstuetzt'}), 404)
@app.route('/')
def index():
fact, a = Update()
return """
<!DOCTYPE html>
<head>
<title>Hubobel.de RESTful-API</title>
<link rel="stylesheet" href="http://stash.compjour.org/assets/css/foundation.css">
</head>
<body style="width: 880px; margin: auto;">
<h1>Willkommen bei der RESTful-API von hubobel.de</h1>
<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>GET: api.hubobel.de/bitcoin.....: Liefert die aktuellen Bitcoinkurse in EURO</p>
<p>GET: api.hubobel.de/wetter.....: Liefert das aktuelle Wetter in Oggersheim</p>
<p>GET: api.hubobel.de/sprit/'km'.....: Liefert die aktuellen Kraftstoffpreise im Umreis von 'km' Radius um 67071</p>
<p>GET: api.hubobel.de/sprit/'Ort'.....: Liefert die aktuellen Kraftstoffpreise im 10km Radius
um den übergebenen Ort</p>
<p>GET: api.hubobel.de/tv.....: Liefert das aktuelle TV Programm der Hauptsender</p>
<p>GET: api.hubobel.de/tv/jetzt.....: Liefert das aktuelle TV Programm aller Sender</p>
<p>GET: api.hubobel.de/tv/2015.....: Liefert das aktuelle TV Programm aller Sender um 20.15Uhr</p>
<p>GET: api.hubobel.de/tv/2200.....: Liefert das aktuelle TV Programm aller Sender um 22.00Uhr</p>
<p>GET: api.hubobel.de/filosophie.....: Liefert Filosophie des SWR3 zurück</p>
<p>GET: api.hubobel.de/shoot/'www.example.de'.....: Liefert Screenshot von example.de zurück</p>
<p>POST: api.hubobel.de/tv/check.....: Uebergabe von beliebigen Sendern als Liste - liefert Programm zurueck</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'])
def get_tasks():
fact, a = Update()
return json.dumps(fact, ensure_ascii=False, sort_keys=True, indent=4)
@app.route('/facts/<int:task_id>', methods=['GET'])
def get_task(task_id):
connection = pymysql.connect(db="hubobel",
user="hubobel",
passwd="polier2003",
host='10.0.1.59', charset='utf8')
cursor = connection.cursor()
sql = "SELECT * FROM facts ORDER BY nr DESC"
resp = cursor.execute(sql)
x = int(resp)
if x < task_id:
return jsonify({'error': "Auch Chuck Norris FACTS sind begrenzt"})
sql_q = "SELECT * FROM facts WHERE nr like '" + str(task_id) + "'"
cursor.execute(sql_q)
resp = cursor.fetchall()
resp = (resp[0][1])
cursor.close()
connection.close()
return json.dumps(resp, ensure_ascii=False, sort_keys=True, indent=4)
@app.route('/facts/zufall', methods=['GET'])
def zufall():
connection = pymysql.connect(db="hubobel",
user="hubobel",
passwd="polier2003",
host='10.0.1.59', charset='utf8')
cursor = connection.cursor()
sql = "SELECT * FROM facts ORDER BY nr DESC"
resp = cursor.execute(sql)
x = int(resp)
ran = random.randint(1, x)
print(x, ran)
sql_q = "SELECT * FROM facts WHERE nr like '" + str(ran) + "'"
resp = cursor.execute(sql_q)
resp = cursor.fetchall()
resp = (resp[0][1])
cursor.close()
connection.close()
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 = []
Lottofee = []
a = 1
while a != 7:
Lottozahlen.append(Lottozahlen_aktuell['Z' + str(a)])
Lottofee.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,
'aktuelle Ziehung': Lottofee[:6], 'aktuelle Superzahl': Lottozahlen_aktuell['Superzahl'],
'Ziehung vom': Lottozahlen_aktuell['Datum']})
@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 = []
Lottofee = []
a = 1
while a != 6:
Lottozahlen.append(ZahlenEuro_aktuell['Z' + str(a)])
Lottofee.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,
'aktuelle Ziehung': Lottofee[:5], 'aktuelle Eurozahl1': ZahlenEuro_aktuell['Eurozahl1'],
'aktuelle Eurozahl2': ZahlenEuro_aktuell['Eurozahl2'], 'Ziehung vom': ZahlenEuro_aktuell['Datum']})
@app.route('/kodi', methods=['GET'])
def kodi():
connection = pymysql.connect(db="MyVideos107",
user="hubobel",
passwd="polier2003",
host='10.0.1.59', charset='utf8')
cursor = connection.cursor()
sql = "SELECT * FROM movie_view ORDER BY playCount DESC"
resp = cursor.execute(sql)
x = cursor.fetchall()
a = 1
antwort = {}
for i in x:
antwort[a] = i[2]
a = a + 1
return jsonify(antwort)
@app.route('/bitcoin', methods=['GET'])
def bitcoin():
url_zitat = 'https://blockchain.info/de/ticker'
resp_zitat = req.get(url_zitat)
data_zitat = resp_zitat.json()
return jsonify(data_zitat['EUR'])
@app.route('/wetter', methods=['GET'])
def wetter():
url = 'http://api.wunderground.com/api/35a8e37c649985d5/conditions/lang:DL/q/Germany/pws:ILUDWIGS227.json'
response = req.get(url)
data_response = response.json()
temperatur = (data_response['current_observation']['temp_c'])
wetter = (data_response['current_observation']['weather'])
feuchte = (data_response['current_observation']['relative_humidity'])
return jsonify({'Temperatur': temperatur, 'Wetter': wetter, 'Feuchte': feuchte})
@app.route('/sprit/<int:task_id>', methods=['GET'])
def sprit(task_id):
url = 'https://creativecommons.tankerkoenig.de/json/list.php?lat=49.492995&lng=8.358411&' \
'rad=' + str(task_id) + '&sort=dist&type=all&apikey=e5574b6b-9470-b1dd-7745-187750cf439a'
resp = req.get(url)
data = resp.json()
station = {}
daten = {}
for i in data['stations']:
daten['Ort'] = i['place']
daten['Adresse'] = i['street']
daten['preis_diesel'] = i['diesel']
daten['preis_e5'] = i['e5']
daten['preis_e10'] = i['e10']
station[i['name']] = {}
station[i['name']].update(daten)
return jsonify(station)
@app.route('/sprit/<string:task_id>', methods=['GET'])
def test(task_id):
url = 'https://maps.googleapis.com/maps/api/geocode/json'
params = {'sensor': 'false', 'address': task_id, 'key': 'AIzaSyDdT2hs83_FklFfJDulHf62V7HKWDu0VtU'}
r = req.get(url, params=params)
results = r.json()['results']
location = results[0]['geometry']['location']
lat = location['lat']
lng = location['lng']
url = 'https://creativecommons.tankerkoenig.de/json/list.php?lat=' + str(lat) + '&lng=' + str(lng) + \
'&rad=10&sort=dist&type=all&apikey=e5574b6b-9470-b1dd-7745-187750cf439a'
print(url)
resp = req.get(url)
data = resp.json()
station = {}
daten = {}
for i in data['stations']:
daten['Ort'] = i['place']
daten['Adresse'] = i['street']
daten['preis_diesel'] = i['diesel']
daten['preis_e5'] = i['e5']
daten['preis_e10'] = i['e10']
station[i['name']] = {}
station[i['name']].update(daten)
return jsonify(station)
@app.route('/tv/jetzt', methods=['GET'])
def tv_now():
Sendungen = TV(0)
return jsonify(Sendungen)
@app.route('/tv/2015', methods=['GET'])
def tv_abends():
Sendungen = TV(1)
return jsonify(Sendungen)
@app.route('/tv/2200', methods=['GET'])
def tv_nachts():
Sendungen = TV(2)
return jsonify(Sendungen)
@app.route('/tv', methods=['GET'])
def tv():
Sendungen = TV(3)
return jsonify(Sendungen)
@app.route('/tv/check', methods=['POST'])
def tv_check():
auswahl = request.json
Sendungen = TV(0)
rück = {}
for i in auswahl:
if i in Sendungen.keys():
rück[i] = {}
rück[i].update(Sendungen[i])
return jsonify(rück)
@app.route('/beta', methods=['GET'])
def beta():
req.packages.urllib3.disable_warnings()
sauce = req.get(
'https://www.sachsenlotto.de/portal/zahlen-quoten/gewinnzahlen/eurojackpot-gewinnzahlen/eurojackpot-gewinnzahlen.jsp',
verify=False)
soup = bs.BeautifulSoup(sauce.text, 'lxml')
zahlen = []
ergebniss = []
ZahlenEuro = {'Datum': '', 'Z1': '', 'Z2': '', 'Z3': '', 'Z4': '', 'Z5': '', 'Eurozahl1': '', 'Eurozahl2': ''}
a = 1
source = soup.find_all('span',
class_='sl-statistic-number-circle-container-filled col-lg-1 col-md-1 col-sm-1 col-xs-1')
for i in source:
zahlen.append(i.text)
while a <= 5:
ZahlenEuro['Z' + str(a)] = int(zahlen[a - 1])
a += 1
ZahlenEuro['Eurozahl1'] = zahlen[5]
ZahlenEuro['Eurozahl2'] = zahlen[6]
print(ZahlenEuro)
source = soup.find_all('h3', style='color: white')
for i in source:
datum = i.text
return jsonify(ZahlenEuro, datum)
@app.route('/ferien/<string:task_id>', methods=['GET'])
def ferien(task_id):
url = 'http://api.smartnoob.de/ferien/v1/ferien/?bundesland=' + task_id
resp = req.get(url)
data = resp.json()
ferien = False
jetzt = 356
for i in data['daten']:
beginn = int(datetime.datetime.fromtimestamp(i['beginn']).strftime('%j'))
ende = int(datetime.datetime.fromtimestamp(i['ende']).strftime('%j')) - 1
if jetzt <= ende and jetzt >= beginn:
ferien = True
if jetzt >= beginn and ende > beginn:
ferien = True
if jetzt <= ende:
ferien = True
if jetzt > ende and jetzt < beginn:
ferien = False
return jsonify(ferien)
@app.route('/filosophie', methods=['GET'])
def filosphie():
connection = pymysql.connect(db="hubobel",
user="hubobel",
passwd="polier2003",
host='10.0.1.59', charset='utf8')
cursor = connection.cursor()
sql = "SELECT * FROM Filosofie"
resp = cursor.execute(sql)
x = cursor.fetchall()
fact = dict(x)
cursor.close()
connection.close()
return json.dumps(fact, ensure_ascii=False, sort_keys=True, indent=4)
@app.route('/energy', methods=['GET'])
def energy():
Pfad = ''
Pfad = '/home/'
options = Options()
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
driver = webdriver.Chrome(chrome_options=options)
driver.set_window_size(1024, 768)
driver.get("http://10.0.1.59:1880/ui/#/1")
for isec in (4, 3, 2, 1):
driver.execute_script("window.scrollTo(0, document.body.scrollHeight / %s);" % isec)
sleep(1)
driver.save_screenshot(Pfad + "dashboard.png")
return send_file(Pfad + 'dashboard.png')
@app.route('/shoot/<string:task_id>', methods=['GET'])
def shoot(task_id):
url = 'http://' + task_id
Pfad = '/home/'
# Pfad=''
# run first time to get scrollHeight
chrome_options = Options()
chrome_options.add_argument("--headless")
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
chrome_options.add_argument("--hide-scrollbars")
driver = webdriver.Chrome(options=chrome_options)
driver.set_window_size(2560, 1600)
driver.get(url)
# pause 3 second to let page load
time.sleep(3)
driver.save_screenshot(Pfad + task_id + '.png')
driver.close()
return send_file(Pfad + task_id + '.png')
if __name__ == '__main__':
app.run(host='0.0.0.0')

View file

@ -1,10 +0,0 @@
import requests
url_WZ = 'http://10.0.1.241/cgi-bin/api.cgi?cmd=Login'
payload = '[{"cmd": "Login", "action": 0, "param": {"User": {"userName": "admin", "password": "polier2003"}}}]'
r = requests.post(url=url_WZ, data=payload)
data = r.json()
token = str((data[0]['value']['Token']['name']))
url = 'http://10.0.1.241/cgi-bin/api.cgi?cmd=SetIsp&token=' + token
payload = '[{"cmd":"SetIsp","action":0,"param":{"Isp":{"channel":0,"antiFlicker":"50HZ","exposure":"Auto","gain":{"min":1,"max":62},"shutter":{"min":0,"max":125},"blueGain":128,"redGain":128,"whiteBalance":"Auto","dayNight":"Color","backLight":"DynamicRangeControl","blc":128,"drc":128,"rotation":0,"mirroring":0,"nr3d":1}}}]'
r = requests.post(url=url, data=payload)

View file

@ -1,74 +0,0 @@
import random
from flask import Flask, jsonify,make_response
import pymysql
app = Flask(__name__)
def Update():
connection = pymysql.connect(db="hubobel",
user="hubobel",
passwd="polier2003",
host='10.0.1.59',charset='utf8')
cursor = connection.cursor()
sql="SELECT * FROM facts"
resp=cursor.execute(sql)
x=cursor.fetchall()
fact=dict(x)
cursor.close()
connection.close()
a=len(fact)
return fact,a
@app.errorhandler(404)
def not_found(error):
return make_response(jsonify({'error': 'Nicht unterstuetzt'}), 404)
@app.route('/')
def index():
fact,a = Update()
fact={
'POST:api.hubobel.de/facts.....':'Uebersicht ueber alle verfuegbaren Facts mit ihrer ID',
'POST: api.hubobel.de/facts/<ID>.....':'JSON des abgefragten Facts',
'POST: api.hubobel.de/facts/9999.....':'ein zufaellig ausgewaehlter Fact wird im JSON zurueck gegeben',
'facts':a}
return jsonify({'eine REST-API von hubobel.de Methoden/Funktionen':fact})
@app.route('/facts', methods=['GET'])
def get_tasks():
fact, a = Update()
return jsonify({'facts': fact})
@app.route('/facts/<int:task_id>', methods=['GET'])
def get_task(task_id):
connection = pymysql.connect(db="hubobel",
user="hubobel",
passwd="polier2003",
host='10.0.1.59', charset='utf8')
cursor = connection.cursor()
sql = "SELECT * FROM facts ORDER BY nr DESC"
resp = cursor.execute(sql)
x = int(resp)
if x<task_id:
return jsonify({'error':"Auch Chuck Norris FACTS sind begrenzt"})
sql_q = "SELECT * FROM facts WHERE nr like '" + str(task_id) + "'"
cursor.execute(sql_q)
resp = cursor.fetchall()
resp = (resp[0][1])
cursor.close()
connection.close()
return jsonify({'fact': resp})
@app.route('/zufall', methods=['GET'])
def zufall():
connection = pymysql.connect(db="hubobel",
user="hubobel",
passwd="polier2003",
host='10.0.1.59', charset='utf8')
cursor = connection.cursor()
sql = "SELECT * FROM facts ORDER BY nr DESC"
resp = cursor.execute(sql)
x = int(resp)
ran = random.randint(1, x)
print(x, ran)
sql_q = "SELECT * FROM facts WHERE nr like '" + str(ran) + "'"
resp = cursor.execute(sql_q)
resp = cursor.fetchall()
resp = (resp[0][1])
cursor.close()
connection.close()
return jsonify({ran: resp})
if __name__ == '__main__':
app.run(host='0.0.0.0')

25
SQL.py
View file

@ -1,25 +0,0 @@
import pymysql
connection = pymysql.connect(db="hubobel",
user="hubobel",
passwd="polier2003",
host='10.0.1.123',charset='utf8')
cursor = connection.cursor()
try:
cursor.execute("""CREATE TABLE speed (
nr INT, timestamp TEXT,server TEXT,ip TEXT, ping FLOAT, download FLOAT, upload FLOAT)""")
except:
print ('weiter')
sql = "SELECT * FROM speed"
Anzahl = cursor.execute(sql)
resp = cursor.fetchall()
a = (len(resp)) - 7
resp = resp[a:]
for i in resp:
print(i[5])
cursor.close()
connection.close()

View file

@ -1,36 +0,0 @@
from selenium import webdriver
from time import sleep
driver = webdriver.Chrome()
driver.get("https://www.youtube.com")
# scroll some more
for isec in (4, 3, 2, 1):
driver.execute_script("window.scrollTo(0, document.body.scrollHeight / %s);" % isec)
sleep(1)
# load more
sleep(2)
print("push Load more...")
#driver.find_element_by_css_selector('button.load-more-button').click()
print("wait a bit...")
sleep(2)
print("Jump to the bottom, work our way back up")
for isec in (1, 2, 3, 4, 5):
driver.execute_script("window.scrollTo(0, document.body.scrollHeight / %s);" % isec)
sleep(1)
driver.execute_script("window.scrollTo(0, 0)")
print("Pausin a bit...")
sleep(2)
print("Scrollin to the top so that the nav bar isn't funny looking")
driver.execute_script("window.scrollTo(0, 0);")
sleep(1)
print("Screenshotting...")
# screenshot
driver.save_screenshot("youtube.com.jpg")

View file

@ -1,50 +0,0 @@
#!/usr/bin/env python3
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import telebot
import sys
from time import sleep
Pfad=''
#Pfad='/home/'
#todo
# Einbau User Agent
# kompletter screenshot!!!!
url=sys.argv[1]
url = url.replace ('http://','')
url = 'http://' + url
ios6ua = '--user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 10_2_1 like Mac OS X) AppleWebKit/602.4.6 (KHTML, like Gecko) Version/10.0 Mobile/14D27 Safari/602.1"'
if (len(sys.argv)) == 3:
zoom = sys.argv[2]
else:
zoom = '1'
options = Options()
# options.add_argument('--headless')
# options.add_argument('--no-sandbox')
# options.add_argument('--disable-dev-shm-usage')
options.add_argument(ios6ua)
print(options.arguments)
driver=webdriver.Chrome(chrome_options=options)
#driver.set_window_size(1024, 768)
driver.get(url)
driver.execute_script("document.body.style.zoom='"+zoom+"'")
for isec in (4, 3, 2, 1):
driver.execute_script("window.scrollTo(0, document.body.scrollHeight / %s);" % isec)
sleep(1)
driver.save_screenshot(Pfad+"dashboard.png")
driver.close()
# TOKEN='680737840:AAEaa7Vxl_kZz_LWS1_S-lH6Eda7HXqu6Y4'
# ChatID='322673713'
# tb = telebot.TeleBot(TOKEN)
# document=open(Pfad+'dashboard.png','rb')
# tb.send_photo(ChatID,document)

View file

@ -1,10 +0,0 @@
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)

View file

@ -1,6 +0,0 @@
from libsoundtouch import discover_devices
devices = discover_devices(timeout=2) # Default timeout is 5 seconds
for device in devices:
print(device.config.name + " - " + device.config.type)

View file

@ -1,40 +0,0 @@
import urllib.request
class soundtouch():
def __init__(self):
self.url="http://10.0.1.27:8090/"
def Webaufruf(self,befehl):
try:
self.urli=self.url+befehl
antwort = urllib.request.urlopen(self.urli)
b = (antwort.read())
self.xmlString = b.decode("utf-8")
return self.xmlString
except:
return None
def now_playing(self):
return self.Webaufruf("now_playing")
return antwort
def info(self):
return self.Webaufruf("info")
def sources(self):
return self.Webaufruf("sources")
def presets(self):
return self.Webaufruf("presets")
def volume(self):
return self.Webaufruf("volume")
def suche (self,suchstring):
string = self.info()
anfang = string.find("<"+suchstring+">") + len("<"+suchstring+">")
ende = string.find("</"+suchstring+">")
if ende != -1:
return string[anfang:ende]
else:
return None
bose=soundtouch()
print((bose.info()))
print((bose.presets()))
print((bose.volume()))
print((bose.now_playing()))
print((bose.suche("softwareVersion")))

View file

@ -1,39 +0,0 @@
import urllib.request
class soundtouch():
def __init__(self):
self.url="http://10.0.1.27:8090/"
def Webaufruf(self,befehl):
try:
self.urli=self.url+befehl
antwort = urllib.request.urlopen(self.urli)
b = (antwort.read())
self.xmlString = b.decode("utf-8")
return self.xmlString
except:
return None
def now_playing(self):
return self.Webaufruf("now_playing")
return antwort
def info(self):
return self.Webaufruf("info")
def sources(self):
return self.Webaufruf("sources")
def presets(self):
return self.Webaufruf("presets")
def volume(self):
return self.Webaufruf("volume")
def suche (self,suchstring):
string = self.info()
anfang = string.find("<"+suchstring+">") + len("<"+suchstring+">")
ende = string.find("</"+suchstring+">")
if ende != -1:
return string[anfang:ende]
else:
return None
bose=soundtouch()
print(bose.info())
print(bose.volume())
print(bose.now_playing())
print(bose.suche("serialNumber"))

View file

@ -1,55 +0,0 @@
import speedtest
import pymysql
import time
###################
version = "1.1"
##################
connection = pymysql.connect(db="hubobel",
user="hubobel",
passwd="polier2003",
host='10.0.1.123',charset='utf8')
cursor = connection.cursor()
try:
cursor.execute("""CREATE TABLE speed (
nr INT, timestamp TEXT,server TEXT,ip TEXT, ping FLOAT, download FLOAT, upload FLOAT, Version TEXT)""")
except:
print ('weiter')
sql = "SELECT * FROM speed ORDER BY Nr DESC"
Anzahl = cursor.execute(sql)
Anzahl = int(Anzahl+1)
servers = []
threads = None
s = speedtest.Speedtest()
s.get_servers(servers)
s.get_best_server()
s.download(threads=threads)
s.upload(threads=threads)
s.results.share()
#results_dict = {'client': {'rating': '0', 'loggedin': '0', 'isprating': '3.7', 'ispdlavg': '0', 'ip': '84.63.254.177', 'isp': 'Vodafone Germany DSL', 'lon': '8.1189', 'ispulavg': '0', 'country': 'DE', 'lat': '49.7403'}, 'bytes_sent': 22970368, 'download': 28727296.703763857, 'timestamp': '2022-01-02T15:26:51.753501Z', 'share': u'http://www.speedtest.net/result/12547122848.png', 'bytes_received': 36013552, 'ping': 15.811, 'upload': 17662540.706131537, 'server': {'latency': 15.811, 'name': 'Frankfurt', 'url': 'http://speedtest.ropa.de:8080/speedtest/upload.php', 'country': 'Germany', 'lon': '8.6821', 'cc': 'DE', 'host': 'speedtest.ropa.de:8080', 'sponsor': 'ropa GmbH & Co. KG', 'lat': '50.1109', 'id': '37748', 'd': 57.65047622507195}}
results_dict = s.results.dict()
up = float(results_dict['upload'])/1000000
ping = float(results_dict['ping'])
down = float(results_dict['download'])/1000000
ip = str(results_dict['client']['ip'])
server = str(results_dict['server']['url'])
down = round(down, 2)
up = round(up, 2)
ping = round(ping, 1)
time = (time.strftime("%Y-%m-%d-%H.%M.%S"))
val = f'"{Anzahl}", "{time}", "{server}", "{ip}", "{ping}", "{down}", "{up}", "{version}"'
sql = f'INSERT INTO speed VALUE ({val})'
resp = cursor.execute(sql)
connection.commit()
cursor.close()
connection.close()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 295 KiB

Binary file not shown.

View file

@ -1,11 +0,0 @@
import os
import time
path = "testa"
monat = (time.strftime("%m"))
jahr = (time.strftime("%Y"))
path = path + '/' + jahr + '/' + monat
if os.path.exists(path) == False:
print('gibts nicht')
os.makedirs(path)

View file

@ -1,27 +0,0 @@
import urllib.request
import requests
from datetime import datetime as DateTime
import time
import os
path = os.getcwd() + "/cameras/wz"
print(path)
monat = (time.strftime("%m"))
jahr = (time.strftime("%Y"))
tag = (time.strftime("%d"))
path = path + '/' + jahr + '/' + monat + '/' + tag
if not os.path.exists(path):
print('gibts nicht')
os.makedirs(path)
while True:
url_WZ = 'http://10.0.1.241/api.cgi?cmd=GetMdState&user=admin&password=polier2003'
resp_WZ = requests.get(url_WZ)
data_WZ = resp_WZ.json()
motion_wz = data_WZ[0]['value']['state']
if motion_wz == 1:
Zeit = DateTime.now().strftime('%H_%M_%S')
url = 'http://10.0.1.241/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=wuuPhkmUCeI9WG7C&user=admin&password=polier2003'
urllib.request.urlretrieve(url, path + '/Bild'+Zeit+'.jpg')
time.sleep(2)

24
USB.py
View file

@ -1,24 +0,0 @@
import os
from shutil import copyfile
import time
while True:
mount = os.getcwd() + "/media"
b = os.getcwd() + "/Ziel"
inhaltmount = (os.listdir(mount))
for all in inhaltmount:
try:
a = os.getcwd() + "/media/" + all
inhalta = (os.listdir(a))
inhaltb = (os.listdir(b))
print(inhalta)
if "sicherheitgehtvor.txt" in inhalta:
#print('Stick steckt und wurde autentifiziert')
inhalta.remove('sicherheitgehtvor.txt')
for i in inhalta:
if i not in inhaltb:
print('copy')
copyfile(a+'/'+ i, b + '/' + i)
except:
None
time.sleep(2)

View file

@ -1,5 +0,0 @@
from unifi.controller import Controller
c = Controller('10.0.1.59', 'hubobel', 'polier2003','8443', 'v3')
for ap in c.get_aps():
print (ap.get('name'), ap['mac'])

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

View file

@ -1,24 +0,0 @@
from selenium import webdriver
from PIL import Image
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("--headless")
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--start-maximized')
br = webdriver.Chrome(options=chrome_options)
br.set_window_size(1024, 1400)
br.get('https://www.hessenschau.de/wetter/wiesbaden/index.html')
br.refresh()
br.save_screenshot('Wetterscreenshot.png')
br.quit
im = Image.open("Wetterscreenshot.png")
area = (20, 600, 1600, 2500)
cropped_img = im.crop(area)
cropped_img.save('Wetterscreenshot2.png')

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 529 KiB

View file

@ -1,18 +0,0 @@
import requests
import telebot
TOKEN='680737840:AAEaa7Vxl_kZz_LWS1_S-lH6Eda7HXqu6Y4'
ChatID='322673713'
tb = telebot.TeleBot(TOKEN)
url_zitat = 'https://dbf.finalrewind.org/Frankfurt%20Hbf%20(tief).json?version=3'
resp_zitat = requests.get(url_zitat)
data_zitat = resp_zitat.json()
#print (data_zitat)
antwort=''
telegramm='Wiesbaden - Mainz\n'
for i in data_zitat['departures']:
if i['isCancelled'] == 1:
print('cancelled')
print(i)

View file

@ -1,5 +0,0 @@
import time
Zeit = (time.strftime("%Y-%m-%d-%H.%M.%S"))
print(Zeit)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 296 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 300 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 302 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 376 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 322 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 334 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 551 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 342 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 340 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 527 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 338 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 325 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 331 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 338 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 336 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 345 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 343 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 331 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 322 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 330 KiB

Some files were not shown because too many files have changed in this diff Show more