Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: urllib.parse.urlparse() example doesn't parse the params #129745

Open
wjandrea opened this issue Feb 6, 2025 · 1 comment
Open

DOC: urllib.parse.urlparse() example doesn't parse the params #129745

wjandrea opened this issue Feb 6, 2025 · 1 comment
Labels
docs Documentation in the Doc dir

Comments

@wjandrea
Copy link
Contributor

wjandrea commented Feb 6, 2025

https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlparse

>>> urlparse("scheme://netloc/path;parameters?query#fragment")
ParseResult(scheme='scheme', netloc='netloc', path='/path;parameters', params='',
            query='query', fragment='fragment')

I think the problem is here (for v3.13):

if (scheme or '') in uses_params and ';' in url:

I assume scheme isn't a scheme that uses_params, so the params don't get parsed out. On the other hand, https works as expected:

>>> urlparse("https://netloc/path;parameters?query#fragment")
ParseResult(scheme='https', netloc='netloc', path='/path', params='parameters',
            query='query', fragment='fragment')

By the way, the documentation doesn't mention anything about uses_params. Is that an oversight? Should some mention be added?

@wjandrea wjandrea added the docs Documentation in the Doc dir label Feb 6, 2025
@vadmium
Copy link
Member

vadmium commented Feb 8, 2025

A list of supported schemes is given in the second paragraph of the page. A scheme literally named “scheme:” is not listed, so is confusing as an example.

I think uses_params is just an implementation detail (of the documented scheme list) that unfortunately has a public-looking name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
Status: Todo
Development

No branches or pull requests

2 participants