Skip to main content

The ICloud API for events management

Project description

About

The ICloud API for events management

Tools

  • Python 3

How to install with pip

Run this command:

pip 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

How to edit note, url, title or event date

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apple-calendar-integration-0.0.1.tar.gz (5.2 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page