parse_url no longer accepts [] in the URL
See original GitHub issueWith urllib3 1.25.1:
>>> parse_url('https://example.com/somevar[]')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/testrunner/testvenv/lib/python2.7/site-packages/urllib3/util/url.py", line 212, in parse_url
six.raise_from(LocationParseError(url), None)
File "/home/testrunner/testvenv/lib/python2.7/site-packages/urllib3/packages/six.py", line 718, in raise_from
raise value
urllib3.exceptions.LocationParseError: Failed to parse: https://example.com/somevar[]
Using 1.24.2:
>>> parse_url('https://example.com/somevar[]')
Url(scheme='https', auth=None, host='example.com', port=None, path='/somevar[]', query=None, fragment=None)
>>> parse_url('https://example.com/?somevar["whatever"]')
Url(scheme='https', auth=None, host='example.com', port=None, path='/', query='somevar["whatever"]', fragment=None)
This is used by various bits of software (ElasticSearch for instance):
>>> parse_url('http://example.com/api/search/?grouping=datasets&q=dontcare&projection=["variables.nonexistingfield"]')
Url(scheme='http', auth=None, host='example.com', port=None, path='/api/search/', query='grouping=datasets&q=dontcare&projection=["variables.nonexistingfield"]', fragment=None)
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (10 by maintainers)
Top Results From Across the Web
How to Parse URL in JavaScript: hostname, pathname, query ...
How to easily parse URL in JavaScript and access components like hostname, pathname, query, or hash.
Read more >How do I parse a URL into hostname and path in javascript?
The modern way: new URL("http://example.com/aa/bb/"). Returns an object with properties hostname and pathname , along with a few others.
Read more >urllib.parse — Parse URLs into components — Python 3.11.1 ...
The URL parsing functions focus on splitting a URL string into its components, or on combining URL components into a URL string. ......
Read more >IonicaBizau/parse-url - GitHub
GitHub - IonicaBizau/parse-url: An advanced url parser supporting git urls too. ... You can open issues with questions, as long you add a...
Read more >parse_url - Manual - PHP
This function parses a URL and returns an associative array containing any of the various components of the URL that are present.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks for getting on this so quickly!
@sigmavirus24 the tables have turned… I’m reporting issues in your project now 😉
Yes