Request Conditions (autotransform.step.condition.request)
The implementation of Request based conditions.
- class autotransform.step.condition.request.RequestStrCondition(*, comparison: ~autotransform.step.condition.comparison.ComparisonType, value: str | ~typing.List[str], url: str, data: ~typing.Mapping[str, ~typing.Any] = <factory>, headers: ~typing.Mapping[str, ~typing.Any] = <factory>, log_response: bool = False, params: ~typing.Mapping[str, ~typing.Any] = <factory>, post: bool = True, response_field: str | None = None)
Bases:
ComparisonCondition[str]Performs a URL request to get a check a condition on a Change. Used for interacting with REST APIs. Handles the basics of the condition.
- comparison
The type of comparison to perform.
- Type:
- url
The URL to send a request to.
- Type:
str
- value
The value to compare against.
- Type:
str | List[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_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
- response_field
The field containing the desired response value when using the response as JSON. If multiple levels are needed, they should be separated by //. ‘foo//bar’ as an example would get the field at response[‘foo’][‘bar’]. If no response_field is provided the whole response as text is used. Defaults to None.
- Type:
optional, Optional[str]
- name
The name of the Component.
- Type:
ClassVar[ConditionName]
- comparison: ComparisonType
- data: Mapping[str, Any]
- get_val_from_change(change: Change) str
Gets the existing value to compare against from the Change.
- Parameters:
change (Change) – The Change the Condition is checking.
- Returns:
The value from the Change to compare against.
- Return type:
str
- headers: Mapping[str, Any]
- log_response: bool
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: ClassVar[ConditionName] = 'request_str'
- params: Mapping[str, Any]
- post: bool
- response_field: str | None
- url: str
- value: str | List[str]