potiuk commented on code in PR #33289:
URL: https://github.com/apache/airflow/pull/33289#discussion_r1290471842
##########
airflow/providers/elasticsearch/log/es_task_handler.py:
##########
@@ -143,7 +143,9 @@ def format_url(host: str) -> str:
parsed_url = urlparse(host)
# Check if the scheme is either http or https
- if not parsed_url.scheme:
+ # the second condition handles the Python 3.9+ case where urlparse
understands "localhost:9200"
+ # differently than urlparse in Python 3.8 and below
(https://github.com/psf/requests/issues/6455)
+ if not parsed_url.scheme or (parsed_url.scheme not in ("http",
"https") and not parsed_url.netloc):
Review Comment:
Yes. On Python 3.9+ "localhost:9002" parses to :
* schema="localhost"
* netloc=""
This is why the tests started to fail in main and according to
https://github.com/psf/requests/issues/6455 this is expected behaviour :).
Don't ask me why - but it is (read the discussion there, it's entertaining).
--
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]