|
|
|
@ -1,23 +1,23 @@ |
|
|
|
from ics import Calendar |
|
|
|
from ics import Calendar |
|
|
|
import requests, arrow, logging |
|
|
|
import requests, arrow, logging, os |
|
|
|
|
|
|
|
|
|
|
|
# VARIABLES |
|
|
|
# VARIABLES |
|
|
|
log_file = "logfile" |
|
|
|
log_file = "logfile" |
|
|
|
url = "https://0783636d.index-education.net/pronote/ical/Agenda.ics?icalsecurise=3972E4CB6D2FF1DE199B75C1969DC54C867D1CA9A09B1C797A0342D5A2749FD9695E01FD2EE008B66074C8A9C38FB737&version=2021.0.2.3¶m=66683d31266f3d31" |
|
|
|
url = "https://0783636d.index-education.net/pronote/ical/Agenda.ics?icalsecurise=3972E4CB6D2FF1DE199B75C1969DC54C867D1CA9A09B1C797A0342D5A2749FD9695E01FD2EE008B66074C8A9C38FB737&version=2021.0.2.3¶m=66683d31266f3d31" |
|
|
|
dates_file = "./dates.txt" |
|
|
|
dates_file = "dates.txt" |
|
|
|
proxy = "" |
|
|
|
proxy = {"https":"http://172.17.212.1:3128"} |
|
|
|
|
|
|
|
|
|
|
|
logging.basicConfig(level=logging.INFO, filename=log_file, filemode="a+",format="%(asctime)-15s %(levelname)-8s %(message)s") |
|
|
|
logging.basicConfig(level=logging.INFO, filename=os.path.join(os.path.dirname(__file__),log_file), filemode="a+",format="%(asctime)-15s %(levelname)-8s %(message)s") |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
try: |
|
|
|
c = Calendar(requests.get(url,proxies=proxy).text) |
|
|
|
c = Calendar(requests.get(url,proxies=proxy).text) |
|
|
|
e = list(c.timeline) |
|
|
|
e = list(c.timeline.start_after(arrow.utcnow().to('Europe/Paris'))) |
|
|
|
except Exception: |
|
|
|
except Exception: |
|
|
|
logging.error("Erreur lors de l'accès au calendrier ! script annulé") |
|
|
|
logging.error("Erreur lors de l'accès au calendrier ! script annulé") |
|
|
|
exit() |
|
|
|
exit() |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
try: |
|
|
|
f = open(dates_file, "w") |
|
|
|
f = open(os.path.join(os.path.dirname(__file__),dates_file), "w") |
|
|
|
|
|
|
|
|
|
|
|
for x in e: |
|
|
|
for x in e: |
|
|
|
if x.name.casefold() == "lire ensemble": |
|
|
|
if x.name.casefold() == "lire ensemble": |
|
|
|
|