From 5b3c1603c0e7a6ad6db27a53c1d07ca1a4b2aea4 Mon Sep 17 00:00:00 2001 From: hubobel Date: Tue, 10 Oct 2017 11:07:02 +0200 Subject: [PATCH] Prints wurden entfernt, Korrektur der Endzeitberechnung, Booleans angelegt --- Ferien.py | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/Ferien.py b/Ferien.py index e38701d..4fedfed 100644 --- a/Ferien.py +++ b/Ferien.py @@ -8,10 +8,13 @@ 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 = time.strftime('%j') +jetzt = int(time.strftime('%j')) tag = time.strftime('%d') -if int(tag) == 1: +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) @@ -22,9 +25,9 @@ if int(tag) == 1: json.dump(data_ferien, outfile) with open(pfad + '/json_feiertage.data', 'w') as outfile: - json.dump(data_ferien, outfile) + json.dump(data_feiertage, outfile) -if os.path.isfile(pfad+'/json_ferien.data')!= True: +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) @@ -36,7 +39,7 @@ if os.path.isfile(pfad+'/json_ferien.data')!= True: json.dump(data_ferien, outfile) with open(pfad+'/json_feiertage.data','w') as outfile: - json.dump(data_ferien, outfile) + json.dump(data_feiertage, outfile) with open(pfad+'/json_ferien.data') as file: data_ferien=json.load(file) @@ -49,14 +52,33 @@ x = 0 while x = beginn: + ferien = True x = x+1 + +a= len(data_feiertage['daten']) +x = 0 + +while x = beginn: + feiertag = True + + x = x+1 + +print('Es sind Ferien: '+ str(ferien)) +print('Es ist ein Feiertag: '+str(feiertag)) \ No newline at end of file