diff --git a/python/muell.py b/python/muell.py index f227ff5..03536af 100644 --- a/python/muell.py +++ b/python/muell.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 ''' Um die Werte für kommune und strasse zu erfahren, rufe https://www.egst.de/de/abfallabholung/ per @@ -18,6 +18,7 @@ tgBotOwner: ''' import csv +import os import re import requests import httplib2 @@ -44,7 +45,7 @@ def readConfig(): home = Path.home() # home ist ohne / am Ende! config = {} with open(f'{home}/.muell.yaml', 'r') as config_file: - config = yaml.load(config_file, Loader = yaml.FullLoader) + config = yaml.load(config_file) return config @@ -130,10 +131,10 @@ muell_arten = [ if __name__ == '__main__': antwort_liste = read_file(current_year) + config = readConfig() if antwort_liste == None: # Keine vernünftigen Daten, ergo mal gucken, was die Webseite ergibt - config = readConfig() postdata['f_id_kommune'] = config['kommune'] postdata['f_id_strasse'] = config['strasse'] @@ -151,7 +152,6 @@ if __name__ == '__main__': antwort_liste = read_file(current_year) daten = set(antwort_liste) - # TODO: Leider weiss ich ab hier nur, dass Müll abgeholt wird, leider nicht, welcher :-/ tomorrow = (datetime.now() + timedelta(1)).strftime('%d.%m.%Y') for datum in daten: datum = datum.split(';') @@ -164,5 +164,6 @@ if __name__ == '__main__': if len(tonnen) > 0: tonnen = ' und '.join(tonnen) - print(f'Morgen {wird} {tonnen} abgeholt') + # Jetzt den Bot ansprechen + os.system(f'echo "Morgen {wird} {tonnen} abgeholt" | {config["pathBot"]} -u {config["tgReceiver"]}') break