Request Conditions (autotransform.step.condition.request)¶
The implementation of Request based conditions.
- class autotransform.step.condition.request.RequestStrCondition(*, comparison: ComparisonType, value: Union[str, List[str]], url: str, data: Mapping[str, Any] = None, headers: Mapping[str, Any] = None, log_response: bool = False, params: Mapping[str, Any] = None, post: bool = True, response_field: Optional[str] = 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¶
- name: ClassVar[ConditionName] = 'request_str'¶
- params: Mapping[str, Any]¶
- post: bool¶
- response_field: Optional[str]¶
- url: str¶
- value: Union[str, List[str]]¶