airflow.providers.google.suite.hooks.calendar
¶
此模組包含 Google Calendar API hook。
模組內容¶
類別¶
透過 Google Cloud 連線與 Google Calendar 互動。 |
- class airflow.providers.google.suite.hooks.calendar.GoogleCalendarHook(api_version, gcp_conn_id='google_cloud_default', impersonation_chain=None)[原始碼]¶
繼承自:
airflow.providers.google.common.hooks.base_google.GoogleBaseHook
透過 Google Cloud 連線與 Google Calendar 互動。
在 Google Sheet 中讀取和寫入儲存格: https://developers.google.com/calendar/api/v3/reference
- 參數
gcp_conn_id (str) – 擷取連線資訊時使用的連線 ID。
api_version (str) – API 版本。例如 v3
impersonation_chain (str | collections.abc.Sequence[str] | None) – 可選的服務帳戶,用於使用短期憑證模擬身分,或取得列表中最後一個帳戶的 access_token 所需的帳戶鏈結列表,該帳戶將在請求中被模擬身分。如果設定為字串,則該帳戶必須授予原始帳戶 Service Account Token Creator IAM 角色。如果設定為序列,則列表中的身分必須將 Service Account Token Creator IAM 角色授予緊接在前的身分,列表中的第一個帳戶將此角色授予原始帳戶。
- get_events(calendar_id='primary', i_cal_uid=None, max_attendees=None, max_results=None, order_by=None, private_extended_property=None, q=None, shared_extended_property=None, show_deleted=False, show_hidden_invitation=False, single_events=False, sync_token=None, time_max=None, time_min=None, time_zone=None, updated_min=None)[原始碼]¶
從單一 calendar_id 從 Google Calendar 取得事件。
https://developers.google.com/calendar/api/v3/reference/events/list
- 參數
calendar_id (str) – 要互動的 Google Calendar ID
i_cal_uid (str | None) – 選填。指定回應中 iCalendar 格式的事件 ID。
max_attendees (int | None) – 選填。如果出席者人數超過指定人數,則僅傳回參與者。
max_results (int | None) – 選填。在一個結果頁面中傳回的最大事件數。不完整的頁面可以通過回應中非空的 nextPageToken 欄位檢測到。預設值為 250 個事件。頁面大小永遠不能大於 2500 個事件
order_by (str | None) – 選填。可接受的值為
"startTime"
或 “updated”private_extended_property (str | None) – 選填。擴充屬性約束,指定為
propertyName=value
。僅匹配私有屬性。此參數可能會重複多次,以傳回符合所有給定約束的事件。q (str | None) – 選填。自由文字搜尋。
shared_extended_property (str | None) – 選填。擴充屬性約束,指定為
propertyName=value
。僅匹配共用屬性。此參數可能會重複多次,以傳回符合所有給定約束的事件。show_deleted (bool | None) – 選填。預設為 False
show_hidden_invitation (bool | None) – 選填。預設為 False
single_events (bool | None) – 選填。預設為 False
sync_token (str | None) – 選填。從傳回的
nextSyncToken
欄位取得的 Tokentime_max (datetime.datetime | None) – 選填。事件開始時間的上限(不包含),用於篩選。預設為無篩選條件
time_min (datetime.datetime | None) – 選填。事件結束時間的下限(不包含),用於篩選。預設為無篩選條件
time_zone (str | None) – 選填。回應中使用的時區。預設為日曆時區。
updated_min (datetime.datetime | None) – 選填。事件上次修改時間的下限
- create_event(event, calendar_id='primary', conference_data_version=0, max_attendees=None, send_notifications=False, send_updates='false', supports_attachments=False)[原始碼]¶
在指定的日曆上建立事件。
https://developers.google.com/calendar/api/v3/reference/events/insert.
- 參數
calendar_id (str) – 要互動的 Google Calendar ID
conference_data_version (int | None) – 選填。API 用戶端支援的會議資料版本號。
max_attendees (int | None) – 選填。如果出席者人數超過指定人數,則僅傳回參與者。
send_notifications (bool | None) – 選填。預設為 False
send_updates (str | None) – 選填。預設為 “false”。可接受的值為 “all”、“none”、“externalOnly” https://developers.google.com/calendar/api/v3/reference/events#resource