http connection with body credentials #26268
-
Hey Guys,
I currently send the credentials in the code, but I would like them to be in the key manager next to the connection. Tranks for your help. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Yes - you need your server to support basic authentication (default) or any other AuthType supported by requests library You can see how auth is instantiated by the Hook https://github.com/apache/airflow/blob/main/airflow/providers/http/hooks/http.py#L97 And you can read all details (including examples) on how you can write your own custom authentication if the authentication schemes provided by requests are not enough for you https://requests.readthedocs.io/en/latest/user/advanced/#custom-authentication |
Beta Was this translation helpful? Give feedback.
-
@potiuk I am doing this now, but I do need to add an extra field for the HTTP connection type so I can add secret token BS3PasswordFieldWidget. I've tried adding get_connection_form_widgets to my subclass of HttpHook but it doesn't work, do you have any clues on how to make this work? |
Beta Was this translation helpful? Give feedback.
Yes - you need your server to support basic authentication (default) or any other AuthType supported by requests library
. If you need other auth than those supported by requests library, you need to write your own custom Hook extending HTTPHook and implementing any authentication scheme - same as you would in any other Python code using requests library.
You can see how auth is instantiated by the Hook https://github.com/apache/airflow/blob/main/airflow/providers/http/hooks/http.py#L97
And you can read all details (including examples) on how you can write your own custom authentication if the authentication schemes provided by requests are not enough for you https://requests.readthedocs.…