HTTP

Task shell.

class pydolphinscheduler.tasks.http.Http(name: str, url: str, http_method: str | None = 'GET', http_params: str | None = None, http_check_condition: str | None = 'STATUS_CODE_DEFAULT', condition: str | None = None, connect_timeout: int | None = 60000, socket_timeout: int | None = 60000, *args, **kwargs)[source]

Bases: Task

Task HTTP object, declare behavior for HTTP task to dolphinscheduler.

_downstream_task_codes: Set[int]
_task_custom_attr: set = {'condition', 'connect_timeout', 'http_check_condition', 'http_method', 'http_params', 'socket_timeout', 'url'}
_task_relation: Set[TaskRelation]
_timeout: timedelta
_upstream_task_codes: Set[int]
class pydolphinscheduler.tasks.http.HttpCheckCondition[source]

Bases: object

Constant of HTTP check condition.

For now it contain four value: - STATUS_CODE_DEFAULT: when http response code equal to 200, mark as success. - STATUS_CODE_CUSTOM: when http response code equal to the code user define, mark as success. - BODY_CONTAINS: when http response body contain text user define, mark as success. - BODY_NOT_CONTAINS: when http response body do not contain text user define, mark as success.

BODY_CONTAINS = 'BODY_CONTAINS'
BODY_NOT_CONTAINS = 'BODY_NOT_CONTAINS'
STATUS_CODE_CUSTOM = 'STATUS_CODE_CUSTOM'
STATUS_CODE_DEFAULT = 'STATUS_CODE_DEFAULT'
class pydolphinscheduler.tasks.http.HttpMethod[source]

Bases: object

Constant of HTTP method.

DELETE = 'DELETE'
GET = 'GET'
HEAD = 'HEAD'
POST = 'POST'
PUT = 'PUT'

YAML file example

# Define the workflow
workflow:
  name: "Http"

# Define the tasks within the workflow
tasks:
  - name: task
    task_type: Http
    url: "https://httpbin.org/get"
    http_method: "GET"
    http_params:
      - { "prop": "a", "httpParametersType": "PARAMETER", "value": "1" }
      - { "prop": "b", "httpParametersType": "PARAMETER", "value": "2" }
      - {
          "prop": "Content-Type",
          "httpParametersType": "header",
          "value": "test",
        }
    http_check_condition: "STATUS_CODE_CUSTOM"
    condition: "404"