Open thetintin1000 opened 1 month ago
Strange, yarl 1.13.0 is able to parse urls just fine here:
$ python3
Python 3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from yarl import URL
>>> URL("http://localhost:8200")
URL('http://localhost:8200')
>>> URL("http://10.0.0.1:8200")
URL('http://10.0.0.1:8200')
$ pip freeze
idna==3.10
multidict==6.1.0
propcache==0.2.0
typing_extensions==4.12.2
yarl==1.13.0
It's because the _host_validate
is not called when you instantiate URL. See the regex actually breaking the format ip:port
https://github.com/aio-libs/yarl/blob/v1.13.0/yarl/_url.py#L52
@thetintin1000 does it work if you bump aiohttp to 3.10.7?
Describe the bug: Can't use ELASTIC_APM_SERVER_URL = "url:port" when building elastic apm instance from aiohttp app since new url control have been added on Yarl dependent library.
To Reproduce
Environment (please complete the following information)
Additional context Error: File \"/home/nonroot/venv/lib/python3.12/site-packages/yarl/_url.py\", line 1607, in _host_validate\n raise ValueError(\nValueError: Host 'X.X.X.X:8080' cannot contain ':' (at position 11)"
When downgrading yarl to 1.12.1, it's now working again.