icalevents
icalevents copied to clipboard
Can't find the docs??
As above, really - there's a two-line "usage" in README, but I can't find any documentation of how you actually use it..
yes some simple test would be good, I want to fetch upcoming x days as list of events, but can't find any doc how to use this library...
Hey @digitaltoast @devrosx did you find any documentation? Is there any way to use this library besides reading the source?
Yeah, there isn't any documentation it seems... this is unfortunate. TIme to do some source reading I guess...
As a non-developer it took me a while to get my head around it.
Don't install with pip
because the version is out of date. Clone this repository and add to your virtual environment using setup.py
Here's what I came up with:
from icalevents.icalevents import events
from datetime import datetime, timedelta
import pytz
url = 'https://outlook.office365.com/owa/calendar/....ics'
#Start and End need to be in UTC, see PR #108
my_timezone = pytz.timezone('Australia/Melbourne')
now = datetime.now().astimezone(pytz.timezone('UTC'))
future = (now + timedelta(hours=24)).astimezone(pytz.timezone('UTC'))
es = events(url, start=now, end=future)
#Return start date from event
def get_start(event):
return event.start.astimezone(my_timezone)
#Sort events earliest to latest
es.sort(key=get_start)
#Move through each event and print something about it to terminal
for e in es:
e.start = e.start.astimezone(my_timezone)
e.end = e.end.astimezone(my_timezone)
print(e.start.strftime("%Y-%m-%d %H:%M") + ' to ' + e.end.strftime("%Y-%m-%d %H:%M") + ' ' + e.summary )
#You can see all of the object properties in icalparser.py - e.g. uid, summary description, start, end...
Awesome! Thank you.
an example can be found here: https://icalevents.readthedocs.io/en/latest/
closing this old issue :-)