You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.6 KiB
46 lines
1.6 KiB
from dateutil.parser import parse as date_parse
|
|
|
|
from gapi.apis.calendar_api.models import weekdays, Event
|
|
from gapi.apis.calendar_api import calendar_api
|
|
import datetime
|
|
|
|
if __name__ == "__main__":
|
|
|
|
MY_API = calendar_api("fuck google")
|
|
# ~~BODY EXAMPLE~~##~~BODY EXAMPLE~~
|
|
example = {
|
|
"attendees": [{"email": "lpage@example.com"}, {"email": "sbrin@example.com"}],
|
|
"description": "A chance to hear more about Google's\
|
|
developer products.",
|
|
"end": {
|
|
"dateTime": "2015-05-28T17:00:00-07:00",
|
|
"timeZone": "America/Los_Angeles",
|
|
},
|
|
"location": "800 Howard St., San Francisco, CA 94103",
|
|
"recurrence": ["RRULE:FREQ=DAILY;COUNT=2"],
|
|
"reminders": {
|
|
"overrides": [
|
|
{"method": "email", "minutes": 1440},
|
|
{"method": "popup", "minutes": 10},
|
|
],
|
|
"useDefault": False,
|
|
},
|
|
"start": {
|
|
"dateTime": "2015-05-28T09:00:00-07:00",
|
|
"timeZone": "America/Los_Angeles",
|
|
},
|
|
"summary": "Google I/O 2015",
|
|
}
|
|
e = Event(
|
|
date_parse("march 16, 2019 10:00 am"),
|
|
date_parse("march 16, 2019 3:30 pm"),
|
|
"Hang out with Matt",
|
|
)
|
|
CAL_ID = "raphael.roberts48@gmail.com"
|
|
event = Event.from_json(example)
|
|
id = event.upload(MY_API, CAL_ID)
|
|
print(id)
|
|
e2 = Event.from_id(MY_API, CAL_ID, id)
|
|
until = datetime.datetime.today() + datetime.timedelta(days=20)
|
|
e2.add_weekly_recurrence(until, weekdays.MON, weekdays.TUE)
|
|
e2.upload(MY_API, CAL_ID)
|