diff --git a/custom_components/multiscrape/form.py b/custom_components/multiscrape/form.py index 0f54d18..bb67298 100644 --- a/custom_components/multiscrape/form.py +++ b/custom_components/multiscrape/form.py @@ -88,6 +88,7 @@ def __init__( self._parser = parser self._should_submit = True self._cookies = None + self._payload = None def notify_scrape_exception(self): """Make sure form is re-submitted after an exception.""" @@ -134,13 +135,16 @@ async def async_submit(self, main_resource): self._config_name, ) - input_fields.update(self._input_values) + if self._input_values is not None: - _LOGGER.debug( - "%s # Merged input fields with input data in config. Result: %s", - self._config_name, - input_fields, - ) + input_fields.update(self._input_values) + + _LOGGER.debug( + "%s # Merged input fields with input data in config. Result: %s", + self._config_name, + input_fields, + ) + self._payload = input_fields if not method: method = "POST" @@ -152,7 +156,7 @@ async def async_submit(self, main_resource): "form_submit", submit_resource, method=method, - request_data=input_fields, + request_data=self._payload, cookies=self._cookies ) _LOGGER.debug(