import requests response = requests.get('url', auth=('user', 'password')) current = {} for line in response.text.splitlines(): if line[0:12] == 'BEGIN:VEVENT': current = {'location': '', 'summary': '', 'start': ':00000000T080000'} if line[0:7] == 'SUMMARY': current['summary'] = line[8:].strip() if line[0:7] == 'DTSTART': current['start'] = line[8:].strip() if line[0:8] == 'LOCATION': current['location'] = line[9:].strip() if line[0:10] == 'END:VEVENT': zone, timestr = current['start'].split(':') sdate, stime = timestr.split('T') hour, minute, sec = list(map(''.join, zip(*[iter(stime)]*2))) line = "%s %s:%s (%s) %s" % ( sdate, hour, minute, current['location'], current['summary']) print(line.encode('utf8')) # vim: set ft=python et sta ts=4 sts=4 sw=4 tw=80: