Working on gcal
This commit is contained in:
@@ -36,6 +36,28 @@ def main():
|
||||
|
||||
try:
|
||||
service = build("calendar", "v3", credentials=creds)
|
||||
|
||||
calendarids = []
|
||||
calendarsummaries = []
|
||||
calendar_list = (service.calendarList().list()).execute().get("items", [])
|
||||
for result in calendar_list:
|
||||
calendarids.append(result.get("id",[]))
|
||||
calendarsummaries.append(result.get("summary",[]))
|
||||
print("result",result.get("summary",[]),result.get("id",[]))
|
||||
print("summaries",calendarsummaries)
|
||||
print("first result",calendar_list[0])
|
||||
print("first result",calendar_list[len(calendar_list)-1])
|
||||
#result meneelyl@gmail.com meneelyl@gmail.com
|
||||
#result Family family14345103599446093558@group.calendar.google.com
|
||||
#result Meneely Birthdays fjlvq3dnhfvn76ihljocbrhrdc@group.calendar.google.com
|
||||
#result Tim Meneely2 k7iohvqfspej540e37bqr1hkso@group.calendar.google.com
|
||||
#result meneelyt@gmail.com meneelyt@gmail.com
|
||||
#result 1532 Ingomar Heights Road 3a0104e2f97668033b30227726b79f48b9f341a84cd9fa57aa4e23851aee1750@group.calendar.google.com
|
||||
#result Vivienne fb53f1ba30abe33a395cb3483aaba416675e2ac829e9e74ca25c10d4fae593c5@group.calendar.google.com
|
||||
#result Benjamin ed47cdac4f626432af8c0d1956499d258d0365cf3fe6ee70ce73d7d478b0f1dd@group.calendar.google.com
|
||||
#result Madeline c6eed2e9ec829d835357032a344d2f6894677a6e652d04345c73249cd9bff8fb@group.calendar.google.com
|
||||
|
||||
|
||||
|
||||
# Call the Calendar API
|
||||
now = datetime.datetime.now(tz=datetime.timezone.utc).isoformat()
|
||||
@@ -43,7 +65,7 @@ def main():
|
||||
events_result = (
|
||||
service.events()
|
||||
.list(
|
||||
calendarId="primary",
|
||||
calendarId="family14345103599446093558@group.calendar.google.com", #"meneelyt@gmail.com", #"ed47cdac4f626432af8c0d1956499d258d0365cf3fe6ee70ce73d7d478b0f1dd@group.calendar.google.com", #"primary",
|
||||
timeMin=now,
|
||||
maxResults=10,
|
||||
singleEvents=True,
|
||||
@@ -60,7 +82,7 @@ def main():
|
||||
# Prints the start and name of the next 10 events
|
||||
for event in events:
|
||||
start = event["start"].get("dateTime", event["start"].get("date"))
|
||||
print(start, event["summary"])
|
||||
print(start, "--", event["summary"])
|
||||
|
||||
except HttpError as error:
|
||||
print(f"An error occurred: {error}")
|
||||
|
||||
Reference in New Issue
Block a user