Mercurial > code > home > repos > gcalendarwatch
view create_school_cals_2.py @ 48:f2dd88b9964c
rm dead code
author | drewp@bigasterisk.com |
---|---|
date | Mon, 19 Aug 2024 11:28:04 -0700 |
parents | f76f6368e2af |
children | c4230f701df9 |
line wrap: on
line source
import datetime import json from pprint import pprint import tzlocal from calendar_connection import getCalendarService calIdForPerson = json.load(open('gcalendarwatch.conf'))['calId'] service = getCalendarService() def find(calId, s: datetime.datetime, e: datetime.datetime, desc: str): res = service.events().list( calendarId=calId, timeMin=s.isoformat(), timeMax=e.isoformat(), q=desc, maxResults=2500, ).execute() for item in res['items']: if item['description'] != desc: continue yield item['id'] s = datetime.datetime(2024, 8, 1, tzinfo=tzlocal.get_localzone()) e = datetime.datetime(2025, 7, 1, tzinfo=tzlocal.get_localzone()) for id in find(calIdForPerson['asher'], s=s, e=e, desc="auto-gen v3"): service.events().delete(calendarId=calIdForPerson['asher'], eventId=id).execute()