title: How do I check the HTTP response code from an Airflow SimpleHttpOperator?
body: <p>I'm trying to receive the HTTP response code back from a triggered Airflow SimpleHttpOperator. I've seen examples using 'lambda' type, and am doing so by looking in the body of the response, but I was hoping to be able to pass the response <em>code</em> off to a function. My current code (which is 90% from example_http_operator):</p>
  
  <pre><code>import json
  from datetime import timedelta
  
  from airflow import DAG
  from airflow.operators.http_operator import SimpleHttpOperator
  from airflow.sensors.http_sensor import HttpSensor
  from airflow.utils.dates import days_ago
  
  default_args = {
      'owner': 'airflow',
      'depends_on_past': False,
      'start_date': days_ago(2),
      'email': ['me@company.com'],
      'email_on_failure': False,
      'email_on_retry': False,
      'retries': 0,
  }
  
  dag = DAG(dag_id='kick_off_java_task', default_args=default_args)
  
  kickoff_task = SimpleHttpOperator(
       task_id='kick_off_c2c_java_task',
       http_conn_id='test',
       method='GET',
       endpoint='',
       data={ "command": "run" },
       response_check=lambda response: True if "Ok Message" in response.text else False,
       headers={},
       xcom_push=False,
       dag=dag
  )
  </code></pre>
  
  <p>According to the documentation and code, there appears to be a way to have response_check point to a callable, but I am unclear of the syntax, or if I need to head in a completely different direction, such as leveraging xcom.</p>