About
The ICloud API for events management
Tools
- Python 3
How to install with pip
Run this command:
pip3 install apple-calendar-integration
How to create event
from datetime import datetime, timedelta
from apple_calendar_integration import ICloudCalendarAPI
api = ICloudCalendarAPI(username, password)
start_date = int(datetime.now().timestamp())
end_date = start_date + timedelta(hours=2)
etag, ctag, guid = api.create_event('Your title', start_date, end_date)
This python script will create one two hour event from now. etag
, ctag
and guid
will be used to edit or delete event.
How to delete event
from apple_calendar_integration import ICloudCalendarAPI
api = ICloudCalendarAPI(username, password)
api.delete_event(new_etag, ctag, guid)
Should return True
if everything is OK.
How to edit event with repeat
How to add repeat num of times with some frequency
{
"count": 5,
"freq": "daily"
}
This will mean repeat every day for 5 times(days).
freq
has such options:
- daily
- weekly
- monthly
- yearly
How to add repeat until date with some frequency
Also, you can specify not num of times, but with the end date parameter.
{
"until": 1536910206,
"freq": "monthly"
}
All code together
from apple_calendar_integration import ICloudCalendarAPI
api = ICloudCalendarAPI(username, password)
repeat = {
"until": 1536910206,
"freq": "monthly"
}
new_etag = api.edit_event(etag, ctag, guid, repeat=repeat)
Should return new etag
if everything is OK
How to edit event with alarm
If you want to create alarm in the moment of event
{
"before": false
}
If before the event
{
"before": false,
"hours": 3,
"minutes": 2,
"seconds": 1
}
This will send notification about event 3 hours 2 minute and 1 second before event start date
There are such options:
- weeks
- days
- hours
- minutes
- seconds
All code together
from apple_calendar_integration import ICloudCalendarAPI
api = ICloudCalendarAPI(username, password)
alarm = {
"before": False,
"hours": 3,
"minutes": 2,
"seconds": 1
}
new_etag = api.edit_event(etag, ctag, guid, alarm=alarm)
Should return new etag
if everything is OK
How to edit event with invites
How to add new people to event
from apple_calendar_integration import ICloudCalendarAPI
api = ICloudCalendarAPI(username, password)
invites = ["email_1@gmail.com", "email_2@gmail.com"]
new_etag = api.edit_event(etag, ctag, guid, add_invites=invites)
How to remove someone from invites
from apple_calendar_integration import ICloudCalendarAPI
api = ICloudCalendarAPI(username, password)
invites = ["email_1@gmail.com"]
new_etag = api.edit_event(new_etag, ctag, guid, remove_invites=invites)
Should return new etag
if everything is OK
note
, url
, title
or event date
How to edit from apple_calendar_integration import ICloudCalendarAPI
import time
api = ICloudCalendarAPI(username, password)
new_etag = api.edit_event(etag, ctag, guid,
note='New notw', url='https://my_url.com', title='New title',
start_date_timestamp=int(time.time()), end_date_timestamp=int(time.time()) + 1000)
Should return new etag
if everything is OK