Dimitris Kougioumtzis Blog About technology

Read ics file with python3

Category Python

Posted on Sept. 19, 2018



Read ics file with python3


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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()

About

My name is Dimitris Kougioumtzis and i work as a Web developer at Rapidbounce Company

Elsewhere