airflow
airflow copied to clipboard
Small bug: HttpHook chokes on its own default parameter when it does `run_and_check`
I'm working on a PythonOperator which uses HttpHook internally, and when running an airflow test the HttpHook class chokes on its own default None value for extra_options.
Passing {} instead makes it happy as get() works on it.
[2016-01-29 16:19:32,749] {models.py:1041} ERROR - 'NoneType' object has no attribute 'get'
Traceback (most recent call last):
File "/opt/conda/lib/python2.7/site-packages/airflow/models.py", line 1000, in run
result = task_copy.execute(context=context)
File "/opt/conda/lib/python2.7/site-packages/airflow/operators/python_operator.py", line 65, in execute
return_value = self.python_callable(*self.op_args, **self.op_kwargs)
File "/usr/local/src/airflow/dags/my-dag.py", line 33, in getResponse
result = api.run(endpoint, data, headers, extra_options)
File "/opt/conda/lib/python2.7/site-packages/airflow/hooks/http_hook.py", line 62, in run
return self.run_and_check(session, prepped_request, extra_options)
File "/opt/conda/lib/python2.7/site-packages/airflow/hooks/http_hook.py", line 69, in run_and_check
stream = extra_options.get("stream", False)
there should be probably be a None check on https://github.com/airbnb/airflow/blob/d660c145480159ccdb80141a12ff70d0e8eabafc/airflow/hooks/http_hook.py#L67
https://github.com/airbnb/airflow/pull/935