Skip to content

Add a URL builder class to urllib #144362

@KaiTomotake

Description

@KaiTomotake

Feature or enhancement

Proposal:

Currently, when building URLs using the Python standard library, it is necessary to combine functions such as urljoin and urlencode and define a custom helper class. This requires additional boilerplate and effort.

from urllib.parse import urljoin, urlencode

base_url = urljoin("https://example.com", "search")
params = {"q": "python", "page": 1}
full_url = f"{base_url}?{urlencode(params)}"

I propose providing a dedicated class that makes it easy to construct URLs in a clear and structured way.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions