msticpy/sectools/tiproviders/ti_provider_base.py
def _clean_url(url: str) -> Optional[str]:
    """
    Clean URL to remove query params and fragments and any trailing stuff.

    Parameters
    ----------
    url : str
        the URL to check

    Returns
    -------
    Optional[str]
        Cleaned URL or None if the input was not a valid URL

    """
    # Try to clean URL and re-check
    match_url = _HTTP_STRICT_RGXC.search(url)
    if (
        not match_url
        or match_url.groupdict()["protocol"] is None
        or match_url.groupdict()["host"] is None
    ):
        return None

    # build the URL dropping the query string and fragments
    clean_url = match_url.groupdict()["protocol"]
    if match_url.groupdict()["userinfo"]:
        clean_url += match_url.groupdict()["userinfo"]
    clean_url += match_url.groupdict()["host"]
    if match_url.groupdict()["port"]:
        clean_url += ":" + match_url.groupdict()["port"]
    if match_url.groupdict()["path"]:
        clean_url += "/" + match_url.groupdict()["path"]

    return clean_url

    Clean URL to remove query params and fragments and any trailing stuff.

    Parameters
    ----------
    url : str
        the URL to check

    Returns
    -------
    Optional[str]
        Cleaned URL or None if the input was not a valid URL

    
Clean URL to remove query params and fragments and any trailing stuff.
Parameters

url : str
the URL to check

Returns

Optional[str]
Cleaned URL or None if the input was not a valid URL
Clean URL to remove query params and fragments and any trailing stuff . Parameters url : str the URL to check Returns Optional [ str ] Cleaned URL or None if the input was not a valid URL
def _clean_url(url: str) -> Optional[str]:
    match_url = _HTTP_STRICT_RGXC.search(url)
    if (
        not match_url
        or match_url.groupdict()["protocol"] is None
        or match_url.groupdict()["host"] is None
    ):
        return None
    clean_url = match_url.groupdict()["protocol"]
    if match_url.groupdict()["userinfo"]:
        clean_url += match_url.groupdict()["userinfo"]
    clean_url += match_url.groupdict()["host"]
    if match_url.groupdict()["port"]:
        clean_url += ":" + match_url.groupdict()["port"]
    if match_url.groupdict()["path"]:
        clean_url += "/" + match_url.groupdict()["path"]
    return clean_url
def _clean_url ( url : str ) -> Optional [ str ] : match_url = _HTTP_STRICT_RGXC . search ( url ) if ( not match_url or match_url . groupdict ( ) [ "protocol" ] is None or match_url . groupdict ( ) [ "host" ] is None ) : return None clean_url = match_url . groupdict ( ) [ "protocol" ] if match_url . groupdict ( ) [ "userinfo" ] : clean_url += match_url . groupdict ( ) [ "userinfo" ] clean_url += match_url . groupdict ( ) [ "host" ] if match_url . groupdict ( ) [ "port" ] : clean_url += ":" + match_url . groupdict ( ) [ "port" ] if match_url . groupdict ( ) [ "path" ] : clean_url += "/" + match_url . groupdict ( ) [ "path" ] return clean_url
Clean URL to remove query params and fragments and any trailing stuff.
Clean URL to remove query params and fragments and any trailing stuff .
"""
    Clean URL to remove query params and fragments and any trailing stuff.

    Parameters
    ----------
    url : str
        the URL to check

    Returns
    -------
    Optional[str]
        Cleaned URL or None if the input was not a valid URL

    """ # Try to clean URL and re-check # build the URL dropping the query string and fragments
url
str