raphael auv created AIRFLOW-4048:
------------------------------------

             Summary: HttpSensor provide context to response_check
                 Key: AIRFLOW-4048
                 URL: https://issues.apache.org/jira/browse/AIRFLOW-4048
             Project: Apache Airflow
          Issue Type: Improvement
            Reporter: raphael auv
            Assignee: raphael auv
             Fix For: 1.10.0


Actually the response_check do not get by parameter the context , with a simple 
, provide_context option at the constructor , we could provide the context to 
the response_check function

actual code :


{code:java}
    def poke(self, context):
        self.log.info('Poking: %s', self.endpoint)
        try:
            response = self.hook.run(self.endpoint,
                                     data=self.request_params,
                                     headers=self.headers,
                                     extra_options=self.extra_options)
            if self.response_check:
                # run content check on response
                return self.response_check(response)
{code}
 

 
{code:java}
    def poke(self, context):
        self.log.info('Poking: %s', self.endpoint)
        try:
            response = self.hook.run(self.endpoint,
                                     data=self.request_params,
                                     headers=self.headers,
                                     extra_options=self.extra_options)
            if self.response_check:
                # run content check on response
                response_check_kwargs = {}
               if self.provide_context:
                   response_check_kwargs["context"] = context

               return self.response_check(response, **response_check_kwargs)


{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to