Fokko commented on a change in pull request #4890: [AIRFLOW-4048] HttpSensor
provide-context to response_check
URL: https://github.com/apache/airflow/pull/4890#discussion_r292170500
##########
File path: airflow/sensors/http_sensor.py
##########
@@ -81,8 +89,13 @@ def poke(self, context):
headers=self.headers,
extra_options=self.extra_options)
if self.response_check:
+
+ response_check_kwargs = {}
+ if self.provide_context:
+ response_check_kwargs["context"] = context
+
# run content check on response
- return self.response_check(response)
+ return self.response_check(response, **response_check_kwargs)
Review comment:
```suggestion
return self.response_check(response, context)
```
Would do the trick as well, right? This will break backward compatibility
because if the context is undefined, this won't work.
I think we can make this nicer:
```python
if self.response_check:
if self.provide_context:
return self.response_check(response, context)
else:
return self.response_check(response)
```
WDYT?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services