purl is an immutable URL class designed for easy URL-building and manipulation in Python. It provides a clean API for interrogation and transformation of URLs, aiming to offer a more intuitive experience than the standard library's urlparse and urllib modules. The current version is 1.6, released in May 2021, and the project is actively maintained.
pip install purlVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to construct a URL object, access its various components, and perform modifications. Note that all modification methods return a new URL instance due to the library's immutable design.
Always capture the return value of modification methods, e.g., `new_url = old_url.path('new_path')`.Be mindful that `u.some_method()` retrieves a value, while `u.some_method(new_value)` returns a new URL object with `new_value` applied. Always check if you are getting a value or a new instance.
Verify that you are installing and importing the correct library (`pip install purl` for this library) based on your intended use case.
Instead of direct assignment (e.g., `url.scheme = 'https'`), use the chainable methods provided by the `purl` library which return a new `URL` instance with the desired modifications. For example, to change the scheme, use `new_url = url.scheme('https')`.Install the library using pip: `pip install purl`.
Ensure that you pass an integer as the index to `path_segment()` to specify which segment you want. For example, `url.path_segment(0)` to get the first segment.
No dependency data recorded yet.