Compare commits
No commits in common. "1154f5b1dd572aaa22344b031ccc467fc0d261f3" and "d81a17ef610ee9d9d902f568c8c3de57e238abe6" have entirely different histories.
1154f5b1dd
...
d81a17ef61
@ -22,10 +22,6 @@ class CalendarService:
|
|||||||
creds = self._authenticate()
|
creds = self._authenticate()
|
||||||
self.service = build("calendar", "v3", credentials=creds)
|
self.service = build("calendar", "v3", credentials=creds)
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def encode_event_id(id):
|
|
||||||
return b16encode(id.encode("ascii")).decode("ascii").lower().rstrip("=")
|
|
||||||
|
|
||||||
def _authenticate(self) -> Credentials:
|
def _authenticate(self) -> Credentials:
|
||||||
creds = None
|
creds = None
|
||||||
# The file token.json stores the user's access and refresh tokens, and is
|
# The file token.json stores the user's access and refresh tokens, and is
|
||||||
@ -51,7 +47,8 @@ class CalendarService:
|
|||||||
def insert_or_update_event(
|
def insert_or_update_event(
|
||||||
self, calendar_id: str, id: str, title: str, start: datetime, end: datetime
|
self, calendar_id: str, id: str, title: str, start: datetime, end: datetime
|
||||||
):
|
):
|
||||||
event_id = self.encode_event_id(id)
|
event_id = b16encode(id.encode("ascii")).decode("ascii").lower().rstrip("=")
|
||||||
|
print(event_id)
|
||||||
event = {
|
event = {
|
||||||
"id": event_id,
|
"id": event_id,
|
||||||
"summary": title,
|
"summary": title,
|
||||||
@ -79,10 +76,3 @@ class CalendarService:
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def delete_event(self, calendar_id: str, id: str):
|
|
||||||
event_id = self.encode_event_id(id)
|
|
||||||
try:
|
|
||||||
self.service.events().delete(calendar_id, event_id)
|
|
||||||
except HttpError as error:
|
|
||||||
print("Got error when deleting event: ", error)
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "octoprint_reservations"
|
name = "octoprint_reservations"
|
||||||
version = "0.1.1"
|
version = "0.1.0"
|
||||||
description = ""
|
description = ""
|
||||||
authors = [{ name = "Adam Goldsmith", email = "adam@adamgoldsmith.name" }]
|
authors = [{ name = "Adam Goldsmith", email = "adam@adamgoldsmith.name" }]
|
||||||
license-expression = "MIT"
|
license-expression = "MIT"
|
||||||
|
Loading…
Reference in New Issue
Block a user