Read ics file with python3

Python -- Posted on Sept. 19, 2018

Read ics file with python3

              
                import urllib.request
from icalendar import Calendar
url = 'your ics url here'
req = urllib.request.Request(url, headers={'User-Agent': "Mozila Firefox"})
con = urllib.request.urlopen(req)
gcal = Calendar.from_ical(con.read())
for component in gcal.walk():
    if component.name == "VEVENT":
        print(component.get('summary'))
        print(component.get('dtstart').dt)
        print(component.get('dtend').dt)
        print(component.get('dtstamp'))
con.close()
                  
   
            

Related Posts