question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

parse_url no longer accepts [] in the URL

See original GitHub issue

With 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:closed
  • Created 4 years ago
  • Comments:13 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
bertjwregeercommented, Apr 25, 2019

Thanks for getting on this so quickly!

@sigmavirus24 the tables have turned… I’m reporting issues in your project now 😉

1reaction
sigmavirus24commented, Apr 25, 2019

Yes

Read more comments on GitHub >

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

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found