RequestAction (autotransform.step.action.request)

The implementation of RequestAction.

class autotransform.step.action.request.RequestAction(*, url: str, data: Mapping[str, Any] = None, headers: Mapping[str, Any] = None, log_request: bool = False, log_response: bool = False, params: Mapping[str, Any] = None, post: bool = True)

Bases: Action

Performs a URL request for a Change. Used for interacting with REST APIs.

url

The URL to send a request to.

Type

str

data

Data to include in the request. Defaults to {}.

Type

optional, Mapping[str, Any]

headers

Headers to include in the request. Defaults to {}.

Type

optional, Mapping[str, Any]

log_request

Indicates whether to log the request using DebugEvent. Defaults to False.

Type

optional, bool

log_response

Indicates whether to log the response using DebugEvent. Defaults to False.

Type

optional, bool

params

Params to include in the request. Defaults to {}.

Type

optional, Mapping[str, Any]

post

Whether to send the request as a POST. Defaults to True.

Type

optional, bool

name

The name of the component.

Type

ClassVar[ActionName]

data: Mapping[str, Any]
headers: Mapping[str, Any]
log_request: bool
log_response: bool
name: ClassVar[ActionName] = 'request'
params: Mapping[str, Any]
post: bool
static replace_values(data: Mapping[str, Any], identifier: str, replacer: Callable[[str], Any]) Dict[str, Any]

Replaces values in a dictionary with values from a replacing function.

Parameters
  • data (Mapping[str, Any]) – The data to replace values for.

  • identifier (str) – The identifier of the type of value.

  • replacer (Callable[[str], Any]) – The replacing function.

Returns

The replaced data.

Return type

Dict[str, Any]

run(change: Change) bool

Adds a comment to the specified Change.

Parameters

change (Change) – The Change to comment on.

Returns

Whether the comment was successful.

Return type

bool

url: str