-
Notifications
You must be signed in to change notification settings - Fork 14.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Providers/HTTP] Add adapter parameter to HttpHook to allow custom requests adapters #44302
base: main
Are you sure you want to change the base?
[Providers/HTTP] Add adapter parameter to HttpHook to allow custom requests adapters #44302
Conversation
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
c238f0a
to
1697dc2
Compare
- Added `adapter` parameter to `HttpHook` to allow custom HTTP adapters. - Modified `get_conn` to support mounting custom adapters or using TCPKeepAliveAdapter by default. - Added comprehensive tests to validate the functionality of the `adapter` parameter and its integration with `get_conn`. - Ensured all new tests pass and maintain compatibility with existing functionality.
1697dc2
to
7938e2b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welcome to Apache Airflow and thanks for your contribution!
Looks OK overall, I have some comments :)
Thank you, @shahar1, for your detailed review and valuable feedback! I’ve addressed your comments by:
Please let me know if there’s anything else I can improve. I really appreciate your time and support! |
…pter - Added missing `adapter` parameter description to the HttpHook class docstring. - Removed redundant instantiation of `TCPKeepAliveAdapter` in the `run` method since it's already instantiated in `get_conn`.
f94eca0
to
ff2adff
Compare
Thanks :) Regarding the 2nd point - could you please explain why it makes sense to relocate the instanation of |
This PR adds an
adapter
parameter to theHttpHook
, allowing users to mount custom adapters for HTTP request handling. This enhances flexibility and supports use cases like custom retries, timeouts, and SSL handling.Summary of Changes:
adapter
parameter toHttpHook
to allow custom HTTP adapters.get_conn
to support mounting custom adapters or using TCPKeepAliveAdapter by default.adapter
parameter and its integration withget_conn
.Issue Reference:
Closes #44285
Testing and Validation:
~/providers/tests/http/hooks/test_http.py
to validate:pytest providers/tests/http/hooks/test_http.py
using breeze.pre-commit run --files providers/src/airflow/providers/http/hooks/http.py providers/tests/http/hooks/test_http.py
using breeze.Backward Compatibility:
This change is backward-compatible. The new
adapter
parameter is optional and defaults to None, preserving existing behavior.^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rst
or{issue_number}.significant.rst
, in newsfragments.