Skip to content
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

Configure HttpHook's auth_type from Connection #35591

Open
wants to merge 346 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
346 commits
Select commit Hold shift + click to select a range
32fda3c
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla May 13, 2024
8c5ac06
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla May 13, 2024
10bd16e
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla May 14, 2024
70ee492
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla May 15, 2024
76f74f2
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jun 19, 2024
b6ba4d1
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jun 20, 2024
2667681
refactor: Updated HttpHook
davidblain-infrabel Jul 18, 2024
fe05aaf
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jul 18, 2024
81919bc
refactor: Reformatted some docstrings in HttpHook
davidblain-infrabel Jul 18, 2024
078d75e
refactor: HttpHook now uses patched version of Connection + added tes…
davidblain-infrabel Jul 18, 2024
27cf3e7
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jul 18, 2024
d1da151
refactor: Fixed some static checks
davidblain-infrabel Jul 18, 2024
94ad512
refactor: Fixed json import HttpHook
davidblain-infrabel Jul 18, 2024
e9278cb
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jul 19, 2024
1a1606c
docs: Updated docstrings
davidblain-infrabel Jul 19, 2024
ecc4619
docs: Fixed docstring ConnectionWithExtra
davidblain-infrabel Jul 19, 2024
87f9360
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jul 19, 2024
9859251
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jul 19, 2024
daf848e
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jul 19, 2024
43fad6f
docs: Added newline after docstring constructor
davidblain-infrabel Jul 19, 2024
00043c1
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jul 20, 2024
fdc1cbc
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jul 31, 2024
91f6fad
docs: Quoted the get_extra_dejson method in docstring to avoid spelli…
davidblain-infrabel Aug 1, 2024
e01c7a6
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Aug 1, 2024
4d8e992
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Aug 2, 2024
5f54c91
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Aug 7, 2024
c9fe807
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Aug 7, 2024
931f4c1
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Aug 8, 2024
976b34d
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Aug 8, 2024
a1b1418
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Aug 9, 2024
52b9fde
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Aug 13, 2024
68479aa
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Sep 3, 2024
2b90331
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Sep 4, 2024
5c79ea1
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Sep 4, 2024
82a4a02
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Oct 8, 2024
3ff766b
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
davidblain-infrabel Oct 10, 2024
cb3722a
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Oct 10, 2024
378c2d8
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Oct 10, 2024
2260576
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Oct 10, 2024
04a57d9
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Oct 11, 2024
c7fcba2
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Oct 18, 2024
8f7c1c3
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Oct 22, 2024
815e7d1
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Oct 23, 2024
b9afd30
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Nov 7, 2024
8119295
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Nov 12, 2024
9eb9325
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Nov 13, 2024
983785b
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Nov 19, 2024
c9c2ec4
refactor: Refactored HttpHook without mixin to have less difference w…
davidblain-infrabel Jan 10, 2025
ce066f0
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 10, 2025
c9bfc2c
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 10, 2025
b45de87
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 10, 2025
8e1d9eb
refactor: Reformatted imports HttpHook
davidblain-infrabel Jan 10, 2025
8d02ea9
refactor: Re-added missing except in HttpHook
davidblain-infrabel Jan 10, 2025
03a8bec
refactor: Fixed indentation TestHttpHook
davidblain-infrabel Jan 10, 2025
c20f7bd
refactor: Changed checks related to Airflow dependency for http provider
davidblain-infrabel Jan 10, 2025
dfcd97b
refactor: Reformatted TestHttpHook
davidblain-infrabel Jan 11, 2025
3b0ff43
refactor: Refactored test_airflow_dependency_version in TestHttpHook
davidblain-infrabel Jan 11, 2025
ef9f00a
refactor: Removed default_auth_type from LivyHook
davidblain-infrabel Jan 11, 2025
1a60887
refactor: Reformatted and removed duplicate _set_base_url method from…
davidblain-infrabel Jan 11, 2025
d14ec5b
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 11, 2025
f57fe39
refactor: Reorganized imports TestHttpHook
davidblain-infrabel Jan 11, 2025
6f102c0
refactor: Moved import AuthBase to type checking block
davidblain-infrabel Jan 14, 2025
48578ea
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 14, 2025
608f8ef
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 15, 2025
127ab40
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 17, 2025
b8c21de
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 17, 2025
077a606
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 18, 2025
ce01a91
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 19, 2025
9f42716
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 19, 2025
d270fa3
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 20, 2025
50d804e
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 20, 2025
d066a04
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 22, 2025
ca3e21f
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 22, 2025
097a506
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 22, 2025
ec1e376
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 23, 2025
2aa2484
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 24, 2025
787da7d
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 26, 2025
f0a00ff
refactor: Reorganized imports TestHttpHook
davidblain-infrabel Jan 26, 2025
8f43001
refactor: Reorganized imports HttpHook
davidblain-infrabel Jan 26, 2025
affa175
refactor: Only test airflow dependency of http provider when running …
davidblain-infrabel Jan 26, 2025
eb00ddf
refactor: Updated unit tests for HttpHook and ignore deprecation warn…
davidblain-infrabel Jan 26, 2025
979be4a
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 26, 2025
97f4606
refactor: Re-added missing auth test cases for HttpHook
davidblain-infrabel Jan 27, 2025
9c3ab29
refactor: Fixed test_post_request_with_error_code in TestHttpHook
davidblain-infrabel Jan 27, 2025
7648028
feat: Implement `auth_kwargs` parameter in Http Connection
joffreybienvenu-infrabel Nov 12, 2023
a8dbd95
fix: Correctly use auth_type from Connection
joffreybienvenu-infrabel Nov 23, 2023
e740d35
feat: Add Connection documentation
joffreybienvenu-infrabel Nov 24, 2023
e4a226d
feat: Make available auth_types configurable from airflow config
joffreybienvenu-infrabel Dec 5, 2023
92a3897
feat: Add fields for auth config and header config in Http Connection…
joffreybienvenu-infrabel Dec 6, 2023
a92d340
fix: Correctly apply styling to extra fields
joffreybienvenu-infrabel Dec 7, 2023
9532528
feat: Implement simplistic collapsable textarea for "extra"
joffreybienvenu-infrabel Dec 19, 2023
8335844
fix: express clearly empty frozenset creation
joffreybienvenu-infrabel Dec 20, 2023
85b71a8
feat: Refactor Accordion TextArea to use wtform utils
joffreybienvenu-infrabel Dec 20, 2023
4fc54be
feat: Implement 'collapse_extra' field behavior
joffreybienvenu-infrabel Dec 21, 2023
c28df92
feat: Implement parameterizable behavior for collapsible field
joffreybienvenu-infrabel Dec 30, 2023
e3a8544
revert: Remove collapsible field
joffreybienvenu-infrabel Jan 5, 2024
21a29ec
fix: set the default value for "auth_type" as empty string
joffreybienvenu-infrabel Jan 5, 2024
4f07484
fix: Use Livy hook to test invalid extra removal
joffreybienvenu-infrabel Jan 5, 2024
88f53c1
feat: Implement CodeMirrorField for providers
joffreybienvenu-infrabel Jan 8, 2024
2c4169d
revert: Remove CodeMirror from providers
joffreybienvenu-infrabel Jan 8, 2024
5bbcbe3
feat: Add documentation
joffreybienvenu-infrabel Jan 8, 2024
20f7595
feat: Implement auth_type and auth_kwargs in the AsyncHttpHook
joffreybienvenu-infrabel Jan 9, 2024
7274a69
feat: Add tests
joffreybienvenu-infrabel Jan 9, 2024
8e77abd
fix: Add header and auth into FakeSession test object
joffreybienvenu-infrabel Jan 9, 2024
d461201
fix: Use default BasicAuth in LivyAsyncHook
joffreybienvenu-infrabel Jan 9, 2024
2a65846
refactor: Removed docstring for removed json parameter in run method …
davidblain-infrabel Apr 9, 2024
53baee6
refactor: Aligned HttpTrigger with version from main branch
davidblain-infrabel Apr 9, 2024
31a03bd
refactor: Changed docstrings in HttpTrigger to imperative mode
davidblain-infrabel Apr 9, 2024
b72a361
refactor: Updated docstrings of serialize and run method of HttpTrigger
davidblain-infrabel Apr 11, 2024
6b89144
refactor: Moved get_connection_form_widgets method from HttpHook to H…
davidblain-infrabel May 6, 2024
8552a97
refactor: Pass auth_type parameter from LivyHook to constructor of Ht…
davidblain-infrabel May 6, 2024
dad4f28
refactor: Enhanced extra_dejson property to allow load string escaped…
davidblain-infrabel May 7, 2024
d435a62
refactor: Changed conn_type to ftp in test_process_form_invalid_extra…
davidblain-infrabel May 8, 2024
ce11702
refactor: HttpHook now uses patched version of Connection + added tes…
davidblain-infrabel Jul 18, 2024
5642c9a
refactor: Fixed some static checks
davidblain-infrabel Jul 18, 2024
35dfa5c
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
davidblain-infrabel Jan 27, 2025
6d4c228
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 28, 2025
2d7e582
docs: Updated documentation
davidblain-infrabel Jan 28, 2025
9f2915c
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 28, 2025
bb67c14
docs: Fixed path to images
davidblain-infrabel Jan 28, 2025
c0b579f
refactor: Fixed some static checks
davidblain-infrabel Jan 28, 2025
6aea635
refactor: Removed airflow_dependency_version
davidblain-infrabel Jan 28, 2025
316810d
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 28, 2025
d84e40c
refactor: Removed BS3AccordionTextAreaFieldWidget in forms
davidblain-infrabel Jan 28, 2025
9c2eb4c
refactor: Fixed get_extra_dejson method in Connection
davidblain-infrabel Jan 28, 2025
5f19488
refactor: Deleted setup.cfg
davidblain-infrabel Jan 28, 2025
336d082
refactor: Refactored common code for auth used in HttpHook and AsyncH…
davidblain-infrabel Jan 28, 2025
a8e71ed
refactor: Added RuntimeWarning and stacklevel
davidblain-infrabel Jan 28, 2025
24bbb79
refactor: Deprecated the _do_api_call_async of the LivyAsyncHook and …
davidblain-infrabel Jan 28, 2025
07e56c7
refactor: Fixed static types
davidblain-infrabel Jan 28, 2025
72d2158
refactor: Refactored run_method of LivyAsyncHook
davidblain-infrabel Jan 28, 2025
5e08337
refactor: Raise AirflowProviderDeprecationWarning instead of Deprecat…
davidblain-infrabel Jan 29, 2025
eae6600
refactor: Raise NotImplementedError in HttpHook run for mypy
davidblain-infrabel Jan 29, 2025
8767e6e
refactor: Pass empty string if endpoint is None
davidblain-infrabel Jan 29, 2025
449c818
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 29, 2025
00a9bcb
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 29, 2025
a2f9708
refactor: Mock connection instead of persisting them in database
davidblain-infrabel Jan 29, 2025
17af2fd
refactor: Reformatted _do_api_call_async
davidblain-infrabel Jan 29, 2025
0c7fd4e
feat: Implement `auth_kwargs` parameter in Http Connection
joffreybienvenu-infrabel Nov 12, 2023
b28d3f6
fix: Correctly use auth_type from Connection
joffreybienvenu-infrabel Nov 23, 2023
f20cacc
feat: Add Connection documentation
joffreybienvenu-infrabel Nov 24, 2023
0223d7a
feat: Make available auth_types configurable from airflow config
joffreybienvenu-infrabel Dec 5, 2023
91f9b00
feat: Add fields for auth config and header config in Http Connection…
joffreybienvenu-infrabel Dec 6, 2023
eaf8c37
fix: Correctly apply styling to extra fields
joffreybienvenu-infrabel Dec 7, 2023
5fcb44a
feat: Implement simplistic collapsable textarea for "extra"
joffreybienvenu-infrabel Dec 19, 2023
c284414
fix: express clearly empty frozenset creation
joffreybienvenu-infrabel Dec 20, 2023
ef7c070
feat: Refactor Accordion TextArea to use wtform utils
joffreybienvenu-infrabel Dec 20, 2023
138f296
feat: Implement 'collapse_extra' field behavior
joffreybienvenu-infrabel Dec 21, 2023
1f0a171
feat: Implement parameterizable behavior for collapsible field
joffreybienvenu-infrabel Dec 30, 2023
38aeb73
revert: Remove collapsible field
joffreybienvenu-infrabel Jan 5, 2024
3591338
fix: set the default value for "auth_type" as empty string
joffreybienvenu-infrabel Jan 5, 2024
a12d810
fix: Use Livy hook to test invalid extra removal
joffreybienvenu-infrabel Jan 5, 2024
f8449a1
feat: Implement CodeMirrorField for providers
joffreybienvenu-infrabel Jan 8, 2024
04c208e
revert: Remove CodeMirror from providers
joffreybienvenu-infrabel Jan 8, 2024
c8e0888
feat: Add documentation
joffreybienvenu-infrabel Jan 8, 2024
79efb5e
feat: Implement auth_type and auth_kwargs in the AsyncHttpHook
joffreybienvenu-infrabel Jan 9, 2024
0247bc2
feat: Add tests
joffreybienvenu-infrabel Jan 9, 2024
775ae61
fix: Add header and auth into FakeSession test object
joffreybienvenu-infrabel Jan 9, 2024
aa89fdb
fix: Use default BasicAuth in LivyAsyncHook
joffreybienvenu-infrabel Jan 9, 2024
70eee06
refactor: Removed docstring for removed json parameter in run method …
davidblain-infrabel Apr 9, 2024
6a30c52
refactor: Aligned HttpTrigger with version from main branch
davidblain-infrabel Apr 9, 2024
beab41f
refactor: Changed docstrings in HttpTrigger to imperative mode
davidblain-infrabel Apr 9, 2024
feece9a
refactor: Updated docstrings of serialize and run method of HttpTrigger
davidblain-infrabel Apr 11, 2024
42486f6
refactor: Moved get_connection_form_widgets method from HttpHook to H…
davidblain-infrabel May 6, 2024
0575391
refactor: Pass auth_type parameter from LivyHook to constructor of Ht…
davidblain-infrabel May 6, 2024
2bafca4
refactor: Enhanced extra_dejson property to allow load string escaped…
davidblain-infrabel May 7, 2024
8d12d38
refactor: Changed conn_type to ftp in test_process_form_invalid_extra…
davidblain-infrabel May 8, 2024
a1e6217
refactor: HttpHook now uses patched version of Connection + added tes…
davidblain-infrabel Jul 18, 2024
fc75485
refactor: Fixed some static checks
davidblain-infrabel Jul 18, 2024
0eb542a
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
davidblain-infrabel Jan 30, 2025
747f061
refactor: Removed assignation of method with POST value as it is alre…
davidblain-infrabel Jan 30, 2025
98c9ec7
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 30, 2025
80c0b81
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 30, 2025
9b20f78
refactor: Formatted forms
davidblain-infrabel Jan 30, 2025
147fa03
refactor: Cleaned up files
davidblain-infrabel Jan 30, 2025
25aba00
feat: Implement `auth_kwargs` parameter in Http Connection
joffreybienvenu-infrabel Nov 12, 2023
70df6a2
fix: Correctly use auth_type from Connection
joffreybienvenu-infrabel Nov 23, 2023
5eddbc7
feat: Add Connection documentation
joffreybienvenu-infrabel Nov 24, 2023
62aec5b
feat: Make available auth_types configurable from airflow config
joffreybienvenu-infrabel Dec 5, 2023
c047baf
feat: Add fields for auth config and header config in Http Connection…
joffreybienvenu-infrabel Dec 6, 2023
0ea96a8
fix: Correctly apply styling to extra fields
joffreybienvenu-infrabel Dec 7, 2023
53c6fa8
feat: Implement simplistic collapsable textarea for "extra"
joffreybienvenu-infrabel Dec 19, 2023
a6cec2e
fix: express clearly empty frozenset creation
joffreybienvenu-infrabel Dec 20, 2023
c6a9d24
feat: Refactor Accordion TextArea to use wtform utils
joffreybienvenu-infrabel Dec 20, 2023
895c758
feat: Implement 'collapse_extra' field behavior
joffreybienvenu-infrabel Dec 21, 2023
a46b74d
feat: Implement parameterizable behavior for collapsible field
joffreybienvenu-infrabel Dec 30, 2023
fe05f44
revert: Remove collapsible field
joffreybienvenu-infrabel Jan 5, 2024
8369687
fix: set the default value for "auth_type" as empty string
joffreybienvenu-infrabel Jan 5, 2024
1816001
fix: Use Livy hook to test invalid extra removal
joffreybienvenu-infrabel Jan 5, 2024
836f338
feat: Implement CodeMirrorField for providers
joffreybienvenu-infrabel Jan 8, 2024
eeea37c
revert: Remove CodeMirror from providers
joffreybienvenu-infrabel Jan 8, 2024
3474389
feat: Add documentation
joffreybienvenu-infrabel Jan 8, 2024
a51b8af
feat: Implement auth_type and auth_kwargs in the AsyncHttpHook
joffreybienvenu-infrabel Jan 9, 2024
594a9c4
feat: Add tests
joffreybienvenu-infrabel Jan 9, 2024
e2b78af
fix: Add header and auth into FakeSession test object
joffreybienvenu-infrabel Jan 9, 2024
30c8e37
fix: Use default BasicAuth in LivyAsyncHook
joffreybienvenu-infrabel Jan 9, 2024
8429a82
refactor: Removed docstring for removed json parameter in run method …
davidblain-infrabel Apr 9, 2024
3ce2f41
refactor: Aligned HttpTrigger with version from main branch
davidblain-infrabel Apr 9, 2024
7b6b9db
refactor: Changed docstrings in HttpTrigger to imperative mode
davidblain-infrabel Apr 9, 2024
92c0a11
refactor: Updated docstrings of serialize and run method of HttpTrigger
davidblain-infrabel Apr 11, 2024
a82481d
refactor: Moved get_connection_form_widgets method from HttpHook to H…
davidblain-infrabel May 6, 2024
a489d2f
refactor: Pass auth_type parameter from LivyHook to constructor of Ht…
davidblain-infrabel May 6, 2024
f8aa894
refactor: Enhanced extra_dejson property to allow load string escaped…
davidblain-infrabel May 7, 2024
8fbad3b
refactor: Changed conn_type to ftp in test_process_form_invalid_extra…
davidblain-infrabel May 8, 2024
76f6595
refactor: HttpHook now uses patched version of Connection + added tes…
davidblain-infrabel Jul 18, 2024
2c495f9
refactor: Fixed some static checks
davidblain-infrabel Jul 18, 2024
b9fc9a8
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
davidblain-infrabel Jan 31, 2025
14ec36d
refactor: Remove wrong changes from main
davidblain-infrabel Jan 31, 2025
5708242
refactor: fixed get_extra_dejson
davidblain-infrabel Jan 31, 2025
959a5e8
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 31, 2025
8f8f95d
refactor: Removed accordion widget as this won't be implemented in Ai…
davidblain-infrabel Jan 31, 2025
9ae2eee
refactor: Removed obsolete http provider docs under docs
davidblain-infrabel Jan 31, 2025
6a51249
refactor: Fixed tests in TestHttpHook
davidblain-infrabel Jan 31, 2025
899f3eb
refactor: Reformatted TestHttpHook
davidblain-infrabel Jan 31, 2025
0ad8f1a
refactor: Ignore method type
davidblain-infrabel Jan 31, 2025
b04e859
refactor: Changed http conn type to HTTP
davidblain-infrabel Jan 31, 2025
810de77
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
dabla Jan 31, 2025
3574a80
Revert "refactor: Changed http conn type to HTTP"
davidblain-infrabel Feb 3, 2025
40145f8
refactor: Fixed AsyncLivyHook
davidblain-infrabel Feb 3, 2025
115102f
feat: Implement `auth_kwargs` parameter in Http Connection
joffreybienvenu-infrabel Nov 12, 2023
5a2edbe
fix: Correctly use auth_type from Connection
joffreybienvenu-infrabel Nov 23, 2023
c77aea1
feat: Add Connection documentation
joffreybienvenu-infrabel Nov 24, 2023
987a580
feat: Make available auth_types configurable from airflow config
joffreybienvenu-infrabel Dec 5, 2023
dc03c44
feat: Add fields for auth config and header config in Http Connection…
joffreybienvenu-infrabel Dec 6, 2023
7977c40
fix: Correctly apply styling to extra fields
joffreybienvenu-infrabel Dec 7, 2023
408ff50
feat: Implement simplistic collapsable textarea for "extra"
joffreybienvenu-infrabel Dec 19, 2023
d0c4155
fix: express clearly empty frozenset creation
joffreybienvenu-infrabel Dec 20, 2023
c86c136
feat: Refactor Accordion TextArea to use wtform utils
joffreybienvenu-infrabel Dec 20, 2023
7f7aa31
feat: Implement 'collapse_extra' field behavior
joffreybienvenu-infrabel Dec 21, 2023
f8e7c03
feat: Implement parameterizable behavior for collapsible field
joffreybienvenu-infrabel Dec 30, 2023
96b0b2a
revert: Remove collapsible field
joffreybienvenu-infrabel Jan 5, 2024
326f2dd
fix: set the default value for "auth_type" as empty string
joffreybienvenu-infrabel Jan 5, 2024
69a78e5
fix: Use Livy hook to test invalid extra removal
joffreybienvenu-infrabel Jan 5, 2024
e99fa2b
feat: Implement CodeMirrorField for providers
joffreybienvenu-infrabel Jan 8, 2024
48d6040
revert: Remove CodeMirror from providers
joffreybienvenu-infrabel Jan 8, 2024
6c82276
feat: Add documentation
joffreybienvenu-infrabel Jan 8, 2024
9c9edb0
feat: Implement auth_type and auth_kwargs in the AsyncHttpHook
joffreybienvenu-infrabel Jan 9, 2024
cc8b30f
feat: Add tests
joffreybienvenu-infrabel Jan 9, 2024
721a2e1
fix: Add header and auth into FakeSession test object
joffreybienvenu-infrabel Jan 9, 2024
9508efc
fix: Use default BasicAuth in LivyAsyncHook
joffreybienvenu-infrabel Jan 9, 2024
9ab5bdd
refactor: Removed docstring for removed json parameter in run method …
davidblain-infrabel Apr 9, 2024
20f1541
refactor: Aligned HttpTrigger with version from main branch
davidblain-infrabel Apr 9, 2024
16b2f77
refactor: Changed docstrings in HttpTrigger to imperative mode
davidblain-infrabel Apr 9, 2024
d852ccb
refactor: Updated docstrings of serialize and run method of HttpTrigger
davidblain-infrabel Apr 11, 2024
1ea24db
refactor: Moved get_connection_form_widgets method from HttpHook to H…
davidblain-infrabel May 6, 2024
c6e33c2
refactor: Enhanced extra_dejson property to allow load string escaped…
davidblain-infrabel May 7, 2024
5498b33
refactor: Changed conn_type to ftp in test_process_form_invalid_extra…
davidblain-infrabel May 8, 2024
7e21682
refactor: HttpHook now uses patched version of Connection + added tes…
davidblain-infrabel Jul 18, 2024
052ac7c
refactor: Fixed some static checks
davidblain-infrabel Jul 18, 2024
cc908d1
Merge branch 'main' into feature/http-extra-auth-parameter-in-connection
davidblain-infrabel Feb 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion airflow/models/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ def get_extra_dejson(self, nested: bool = False) -> dict:
self.log.exception("Failed parsing the json for conn_id %s", self.conn_id)

# Mask sensitive keys from this list
mask_secret(extra)
mask_secret(obj)

return extra

Expand Down
11 changes: 9 additions & 2 deletions airflow/providers_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@ def _import_hook(
:param package_name: provider package - only needed in case connection_type is missing
: return
"""
from wtforms import BooleanField, IntegerField, PasswordField, StringField
from wtforms import BooleanField, IntegerField, PasswordField, SelectField, StringField, TextAreaField

if connection_type is None and hook_class_name is None:
raise ValueError("Either connection_type or hook_class_name must be set")
Expand All @@ -1031,7 +1031,14 @@ def _import_hook(
raise ValueError(
f"Provider package name is not set when hook_class_name ({hook_class_name}) is used"
)
allowed_field_classes = [IntegerField, PasswordField, StringField, BooleanField]
allowed_field_classes = [
IntegerField,
PasswordField,
StringField,
BooleanField,
TextAreaField,
SelectField,
]
hook_class: type[BaseHook] | None = _correctness_check(package_name, hook_class_name, provider_info)
if hook_class is None:
return None
Expand Down
26 changes: 25 additions & 1 deletion airflow/www/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from flask_appbuilder.forms import DynamicForm
from flask_babel import lazy_gettext
from flask_wtf import FlaskForm
from markupsafe import Markup
from wtforms import widgets
from wtforms.fields import Field, IntegerField, PasswordField, SelectField, StringField, TextAreaField
from wtforms.validators import InputRequired, Optional
Expand Down Expand Up @@ -176,6 +177,29 @@ def populate_obj(self, item):
field.populate_obj(item, name)


class BS3AccordionTextAreaFieldWidget(BS3TextAreaFieldWidget):

@staticmethod
def _make_collapsable_panel(field: Field, content: Markup) -> str:
collapsable_id: str = f"collapsable_{field.id}"
return f"""
<div class="panel panel-default form-panel">
<div class="panel-heading">
<h4 class="panel-title">
<a class="accordion-toggle" data-toggle="collapse" aria-expanded="false" aria-controls="{collapsable_id}" href="#{collapsable_id}">Show</a>
</h4>
</div>
<div class="panel-collapse collapse" id="{collapsable_id}" aria-expanded="false">
{content.__html__()}
</div>
</div>
"""

def __call__(self, field, **kwargs):
text_area = super(BS3TextAreaFieldWidget, self).__call__(field, **kwargs)
return self._make_collapsable_panel(field=field, content=text_area)


@cache
def create_connection_form_class() -> type[DynamicForm]:
"""
Expand Down Expand Up @@ -223,7 +247,7 @@ def process(self, formdata=None, obj=None, **kwargs):
login = StringField(lazy_gettext("Login"), widget=BS3TextFieldWidget())
password = PasswordField(lazy_gettext("Password"), widget=BS3PasswordFieldWidget())
port = IntegerField(lazy_gettext("Port"), validators=[Optional()], widget=BS3TextFieldWidget())
extra = TextAreaField(lazy_gettext("Extra"), widget=BS3TextAreaFieldWidget())
extra = TextAreaField(lazy_gettext("Extra"), widget=BS3AccordionTextAreaFieldWidget())

for key, value in providers_manager.connection_form_widgets.items():
setattr(ConnectionForm, key, value.field)
Expand Down
1 change: 0 additions & 1 deletion airflow/www/templates/airflow/conn_create.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
<meta name="rest_api_enabled" content="{{ rest_api_enabled }}">
<meta name="test_url"
content="{{ url_for('/api/v1.airflow_api_connexion_endpoints_connection_endpoint_test_connection') }}">

{# required for codemirror #}
<link rel="stylesheet" type="text/css" href="{{ url_for_asset('codemirror.css') }}">
<link rel="stylesheet" type="text/css" href="{{ url_for_asset('lint.css') }}">
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/spelling_wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ afterall
AgentKey
aio
aiobotocore
aiohttp
AioSession
aiplatform
Airbnb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,17 @@
raise RuntimeError(
f"The package `apache-airflow-providers-apache-druid:{__version__}` needs Apache Airflow 2.9.0+"
)


def airflow_dependency_version():
import re
from os.path import dirname, join

import yaml

with open(join(dirname(__file__), "provider.yaml"), encoding="utf-8") as file:
for dependency in yaml.safe_load(file)["dependencies"]:
if dependency.startswith("apache-airflow"):
match = re.search(r">=([\d\.]+)", dependency)
if match:
return packaging.version.parse(match.group(1))
144 changes: 43 additions & 101 deletions providers/apache/livy/src/airflow/providers/apache/livy/hooks/livy.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,21 @@

from __future__ import annotations

import asyncio

import json
import re
import warnings
from collections.abc import Sequence
from enum import Enum
from typing import TYPE_CHECKING, Any
from typing import Any

import aiohttp
import requests
from aiohttp import ClientResponseError
from asgiref.sync import sync_to_async

from airflow.exceptions import AirflowException
from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
from airflow.providers.http.exceptions import HttpErrorException
from airflow.providers.http.hooks.http import HttpAsyncHook, HttpHook

if TYPE_CHECKING:
from airflow.models import Connection


class BatchState(Enum):
"""Batch session states."""
Expand Down Expand Up @@ -85,6 +82,14 @@ class LivyHook(HttpHook):
conn_type = "livy"
hook_name = "Apache Livy"

@classmethod
def get_connection_form_widgets(cls) -> dict[str, Any]:
return super().get_connection_form_widgets()

@classmethod
def get_ui_field_behaviour(cls) -> dict[str, Any]:
return super().get_ui_field_behaviour()

def __init__(
self,
livy_conn_id: str = default_conn_name,
Expand All @@ -93,14 +98,10 @@ def __init__(
auth_type: Any | None = None,
endpoint_prefix: str | None = None,
) -> None:
super().__init__()
self.method = "POST"
self.http_conn_id = livy_conn_id
super().__init__(http_conn_id=livy_conn_id, auth_type=auth_type)
self.extra_headers = extra_headers or {}
self.extra_options = extra_options or {}
self.endpoint_prefix = sanitize_endpoint_prefix(endpoint_prefix)
if auth_type:
self.auth_type = auth_type

def get_conn(self, headers: dict[str, Any] | None = None) -> Any:
"""
Expand Down Expand Up @@ -138,7 +139,7 @@ def run_method(
if not self.extra_options:
self.extra_options = {"check_response": False}

back_method = self.method
back_method = self.method # type: ignore
self.method = method
try:
if retry_args:
Expand Down Expand Up @@ -508,11 +509,10 @@ def __init__(
livy_conn_id: str = default_conn_name,
extra_options: dict[str, Any] | None = None,
extra_headers: dict[str, Any] | None = None,
auth_type: Any | None = None,
endpoint_prefix: str | None = None,
) -> None:
super().__init__()
self.method = "POST"
self.http_conn_id = livy_conn_id
super().__init__(http_conn_id=livy_conn_id, auth_type=auth_type)
self.extra_headers = extra_headers or {}
self.extra_options = extra_options or {}
self.endpoint_prefix = sanitize_endpoint_prefix(endpoint_prefix)
Expand All @@ -524,96 +524,27 @@ async def _do_api_call_async(
headers: dict[str, Any] | None = None,
extra_options: dict[str, Any] | None = None,
) -> Any:
"""
Perform an asynchronous HTTP request call.

:param endpoint: the endpoint to be called i.e. resource/v1/query?
:param data: payload to be uploaded or request parameters
:param headers: additional headers to be passed through as a dictionary
:param extra_options: Additional kwargs to pass when creating a request.
For example, ``run(json=obj)`` is passed as ``aiohttp.ClientSession().get(json=obj)``
"""
extra_options = extra_options or {}

# headers may be passed through directly or in the "extra" field in the connection
# definition
_headers = {}
auth = None

if self.http_conn_id:
conn = await sync_to_async(self.get_connection)(self.http_conn_id)

self.base_url = self._generate_base_url(conn)
if conn.login:
auth = self.auth_type(conn.login, conn.password)
if conn.extra:
try:
_headers.update(conn.extra_dejson)
except TypeError:
self.log.warning("Connection to %s has invalid extra field.", conn.host)
if headers:
_headers.update(headers)

if self.base_url and not self.base_url.endswith("/") and endpoint and not endpoint.startswith("/"):
url = self.base_url + "/" + endpoint
else:
url = (self.base_url or "") + (endpoint or "")

async with aiohttp.ClientSession() as session:
if self.method == "GET":
request_func = session.get
elif self.method == "POST":
request_func = session.post
elif self.method == "PATCH":
request_func = session.patch
else:
return {"Response": f"Unexpected HTTP Method: {self.method}", "status": "error"}
warnings.warn(
"The '_do_api_call_async' method is deprecated, use 'run_method' instead",
AirflowProviderDeprecationWarning,
stacklevel=2,
)

for attempt_num in range(1, 1 + self.retry_limit):
response = await request_func(
url,
json=data if self.method in ("POST", "PATCH") else None,
params=data if self.method == "GET" else None,
headers=headers,
auth=auth,
**extra_options,
)
try:
response.raise_for_status()
return await response.json()
except ClientResponseError as e:
self.log.warning(
"[Try %d of %d] Request to %s failed.",
attempt_num,
self.retry_limit,
url,
)
if not self._retryable_error_async(e) or attempt_num == self.retry_limit:
self.log.exception("HTTP error, status code: %s", e.status)
# In this case, the user probably made a mistake.
# Don't retry.
return {"Response": {e.message}, "Status Code": {e.status}, "status": "error"}

await asyncio.sleep(self.retry_delay)

def _generate_base_url(self, conn: Connection) -> str:
if conn.host and "://" in conn.host:
base_url: str = conn.host
else:
# schema defaults to HTTP
schema = conn.schema if conn.schema else "http"
host = conn.host if conn.host else ""
base_url = f"{schema}://{host}"
if conn.port:
base_url = f"{base_url}:{conn.port}"
return base_url
return await self.run_method(
endpoint=endpoint or "",
method=self.method, # type: ignore
data=data,
headers=headers,
extra_options=extra_options,
)

async def run_method(
self,
endpoint: str,
method: str = "GET",
data: Any | None = None,
headers: dict[str, Any] | None = None,
extra_options: dict[str, Any] | None = None,
) -> Any:
"""
Wrap HttpAsyncHook; allows to change method on the same HttpAsyncHook.
Expand All @@ -622,15 +553,26 @@ async def run_method(
:param endpoint: endpoint
:param data: request payload
:param headers: headers
:param extra_options: Additional kwargs to pass when creating a request.
:return: http response
"""
if method not in ("GET", "POST", "PUT", "DELETE", "HEAD"):
return {"status": "error", "response": f"Invalid http method {method}"}

back_method = self.method
back_method = self.method # type: ignore
self.method = method
try:
result = await self._do_api_call_async(endpoint, data, headers, self.extra_options)
async with aiohttp.ClientSession() as session:
result = await super().run(
session=session,
endpoint=endpoint,
data=data,
headers=headers,
extra_options=extra_options or self.extra_options,
)
except HttpErrorException as e:
status, message = str(e).split(":", 1)
return {"Response": {message}, "Status Code": {status}, "status": "error"}
finally:
self.method = back_method
return {"status": "success", "response": result}
Expand Down
Loading
Loading