Comments (5)
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...
from icalevents.
Hey @digitaltoast @devrosx did you find any documentation? Is there any way to use this library besides reading the source?
from icalevents.
Yeah, there isn't any documentation it seems... this is unfortunate. TIme to do some source reading I guess...
from icalevents.
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...
from icalevents.
Awesome! Thank you.
from icalevents.
Related Issues (20)
- Pypi out of date HOT 4
- Error handling recurring events with timezones HOT 3
- Add encoding parameter to events, etc. HOT 1
- Release 0.1.26 missing on pypi HOT 2
- parse_events is unordered? HOT 1
- FileExistsError: [Errno 17] File exists: '.cache'
- Recurring events and timezones branch HOT 1
- Incorrect status of a single declined recurring event HOT 2
- Parsing a non-empty google calendar gives an empty list HOT 4
- update link HOT 1
- Dependencies pinned to outdated versions HOT 4
- Parsing events crashes on certain files on categories HOT 1
- Docs missing `events()` HOT 2
- Can't find an event in between start and end where the delta is less than a day. HOT 1
- Some events are missing if all_day event is within list HOT 1
- [Discussion] Transfer ownership of project to jazzband or similar? HOT 14
- Implement Jazzband guidelines for icalevents HOT 31
- Add typing HOT 3
- Recurring events off by 24 hours when time zone offset is less than start time of event HOT 4
- v0.1.26 release not present on PyPI HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from icalevents.