or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/furl@2.1.x
tile.json

tessl/pypi-furl

tessl install tessl/pypi-furl@2.1.0

URL manipulation made simple.

Agent Success

Agent success rate when using this tile

65%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.59x

Baseline

Agent success rate without this tile

41%

task.mdevals/scenario-10/

Fragment Bookmark Builder

Create and adjust URLs whose fragment contains hierarchical path segments and filter parameters, with control over whether a '?' separates the fragment path from its query.

Capabilities

Builds fragment paths with encoded segments

  • Given base https://docs.example.com/root?page=1, fragment segments ["guides", "install v1.0"], fragment params {lang: "en", step: "1"}, and the separator included, the result is https://docs.example.com/root?page=1#/guides/install%20v1.0?lang=en&step=1 @test

Merges fragment query params with repeatable keys

  • Starting from https://app.example.com/#/reports?view=daily&chart=bar, adding fragment params {chart: ["line", "table"], view: "weekly"} preserves the existing fragment path and yields https://app.example.com/#/reports?view=daily&view=weekly&chart=bar&chart=line&chart=table @test

Removes fragment params cleanly

  • Removing the chart key from https://app.example.com/#/reports?view=weekly&chart=bar&chart=line returns https://app.example.com/#/reports?view=weekly with the fragment path intact and no trailing separators @test

Supports separatorless fragments

  • With separator disabled for base https://app.example.com/dashboard, fragment segments ["reports"], and fragment params {view: "weekly", expand: "table"}, the output is https://app.example.com/dashboard#/reports&view=weekly&expand=table with no '?' between the fragment path and query parameters @test

Implementation

@generates

API

from typing import Iterable, Mapping, Sequence, Union

def build_fragment_url(
    base_url: str,
    fragment_segments: Sequence[str],
    fragment_params: Mapping[str, Union[str, Sequence[str]]],
    *,
    include_separator: bool = True,
) -> str:
    """
    Returns a URL where the fragment path is replaced with `fragment_segments`
    and the fragment query is set from `fragment_params`. When `include_separator`
    is False, no '?' appears between the fragment path and query string.
    """

def merge_fragment_params(
    url: str,
    *,
    add: Mapping[str, Union[str, Sequence[str]]] | None = None,
    remove: Iterable[str] | None = None,
) -> str:
    """
    Returns a URL where the fragment query of `url` is merged with `add`
    (preserving existing key order) and keys in `remove` are removed.
    Does not change fragment path or base URL.
    """

Dependencies { .dependencies }

furl { .dependency }

Handles URL parsing and fragment path/query composition with optional query separators.