Lee-W commented on code in PR #54102:
URL: https://github.com/apache/airflow/pull/54102#discussion_r2253256658


##########
airflow-core/src/airflow/example_dags/example_dag_decorator.py:
##########
@@ -22,13 +22,21 @@
 
 import httpx
 import pendulum
-
+import ipaddress
 from airflow.providers.standard.operators.bash import BashOperator
 from airflow.sdk import BaseOperator, dag, task
 
 if TYPE_CHECKING:
     from airflow.sdk import Context
 
+def is_ip(address: str) -> bool:
+    """Check if the provided address is a valid IP address (supports IPv4 and 
IPv6)."""
+    try:
+        # Try to convert the address to an IP address (supports both IPv4 and 
IPv6)
+        ipaddress.ip_address(address)
+        return True
+    except ValueError:
+        return False

Review Comment:
   would suggest adding a new exception instead of using AirflowException. 
something like `AirflowInvalidIPError`



-- 
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]

Reply via email to