airflow.providers.microsoft.azure.sensors.msgraph

Module Contents

Classes

MSGraphSensor

A Microsoft Graph API sensor which allows you to poll an async REST call to the Microsoft Graph API.

class airflow.providers.microsoft.azure.sensors.msgraph.MSGraphSensor(url, response_type=None, path_parameters=None, url_template=None, method='GET', query_parameters=None, headers=None, data=None, conn_id=KiotaRequestAdapterHook.default_conn_name, proxies=None, api_version=None, event_processor=lambda context, e: ..., result_processor=lambda context, result: ..., serializer=ResponseSerializer, retry_delay=60, **kwargs)[source]

Bases: airflow.sensors.base.BaseSensorOperator

A Microsoft Graph API sensor which allows you to poll an async REST call to the Microsoft Graph API.

Parameters
  • url (str) – The url being executed on the Microsoft Graph API (templated).

  • response_type (kiota_http.httpx_request_adapter.ResponseType | None) – The expected return type of the response as a string. Possible value are: bytes, str, int, float, bool and datetime (default is None).

  • method (str) – The HTTP method being used to do the REST call (default is GET).

  • conn_id (str) – The HTTP Connection ID to run the operator against (templated).

  • proxies (dict | None) – A dict defining the HTTP proxies to be used (default is None).

  • api_version (msgraph_core.APIVersion | str | None) – The API version of the Microsoft Graph API to be used (default is v1). You can pass an enum named APIVersion which has 2 possible members v1 and beta, or you can pass a string as v1.0 or beta.

  • event_processor (Callable[[airflow.utils.context.Context, Any], bool]) – Function which checks the response from MS Graph API (default is the default_event_processor method) and returns a boolean. When the result is True, the sensor will stop poking, otherwise it will continue until it’s True or times out.

  • result_processor (Callable[[airflow.utils.context.Context, Any], Any]) – Function to further process the response from MS Graph API (default is lambda: context, response: response). When the response returned by the KiotaRequestAdapterHook are bytes, then those will be base64 encoded into a string.

  • serializer (type[airflow.providers.microsoft.azure.triggers.msgraph.ResponseSerializer]) – Class which handles response serialization (default is ResponseSerializer). Bytes will be base64 encoded into a string, so it can be stored as an XCom.

template_fields: Sequence[str] = ('url', 'response_type', 'path_parameters', 'url_template', 'query_parameters', 'headers',...[source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

retry_execute(context)[source]
execute_complete(context, event=None)[source]

Execute callback when MSGraphSensor finishes execution.

This method gets executed automatically when MSGraphTrigger completes its execution.

Was this entry helpful?