[Question] validators.url() fails for valid URLs but has a `&` followed by a `?`
Closed this issue · 1 comments
thakkerurvish commented
Description:
The validators.url() function is returning a ValidationError for a URL that is valid on a browser. However, it might not comply the standards.
The issue in above URL is, it has a &
immediately followed by ?
, which does not comply the standards but is a valid URL.
Steps to Reproduce:
- Install the latest version of the validators library
- Run the following code:
import validators
url = "https://www.cheapoair.com/air/listing?&d1=SJC&r1=AMD&dt1=11/04/2024&d2=AMD&r2=SJC&dt2=11/16/2024&tripType=ROUNDTRIP&cl=ECONOMY&ad=1&se=0&ch=0&infs=0&infl=0"
result = validators.url(url)
print(result)
Expected Behavior:
- The function should return True, indicating a valid URL.
Actual Behavior:
- The function returns a ValidationError.
Cheapoair
is a popular website and some other travel websites I obeserved have this issue as well. Should this be considered as bug and be fixed it. Or is this an expected behavior flagging this URLs.
yozachar commented
Have you tried strict_query
parameter?