1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
import locale
import urllib.request
import icalendar
import pytz
import recurring_ical_events
import urllib.error
from datetime import timedelta, datetime
locale.setlocale(locale.LC_ALL, 'fr_FR')
dat2 = datetime.now(pytz.timezone('Europe/Paris'))
# Agenda Tatal
start_date = dat2.date()
end_date = start_date + timedelta(days=30)
url = "https://calendar.google.com/calendar/ical/****************************0586" \
"/basic.ics "
ical_string = urllib.request.urlopen(url).read()
calendar = icalendar.Calendar.from_ical(ical_string)
events = recurring_ical_events.of(calendar).between(start_date, end_date)
pdr = True
for event in events:
pdr = False
start = event["DTSTART"].dt
duration = event["DTEND"].dt - event["DTSTART"].dt
non = event["SUMMARY"]
print(non + " " + start.strftime("%A %d %B %H %M"))
if pdr:
print("Aucun rendez-vous aujourdhui") |
Partager