HsiuChuanHsu commented on issue #54112:
URL: https://github.com/apache/airflow/issues/54112#issuecomment-3153262289
Hi @fritz-astronomer ,
I think the issue is that `self.base_url` is not automatically set via
`_set_base_url`.
```[python]
class HttpHook(BaseHook):
conn_name_attr = "http_conn_id"
default_conn_name = "http_default"
conn_type = "http"
hook_name = "HTTP"
default_host = ""
default_headers: dict[str, str] = {}
def __init__(
self,
method: str = "POST",
http_conn_id: str = default_conn_name,
auth_type: Any = None,
tcp_keep_alive: bool = True,
tcp_keep_alive_idle: int = 120,
tcp_keep_alive_count: int = 20,
tcp_keep_alive_interval: int = 30,
adapter: HTTPAdapter | None = None,
) -> None:
super().__init__()
self.http_conn_id = http_conn_id
self.method = method.upper()
self.base_url: str = ""
self._retry_obj: Callable[..., Any]
self._auth_type: Any = auth_type
```
The `self.base_url` value is assigned when `_set_base_url` is triggered by
`get_conn`. If `get_conn` is not called, `self.base_url` remains empty.
```[python](https://github.com/apache/airflow/blob/main/providers/http/src/airflow/providers/http/hooks/http.py)
def get_conn(
self, headers: dict[Any, Any] | None = None, extra_options:
dict[str, Any] | None = None
) -> Session:
session = Session()
connection = self.get_connection(self.http_conn_id)
self._set_base_url(connection)
session = self._configure_session_from_auth(session, connection) #
type: ignore[arg-type]
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]