def clean_url(url, base_url):
    parsed_url = urlparse(url)
    fragment = '{url.fragment}'.format(url=parsed_url)
    if fragment:
        url = url.split(fragment)[0]
    if not '{url.netloc}'.format(url=parsed_url):
        url = urljoin(base_url, url)
    return url.rstrip(string.punctuation)
Remove URL fragments and add base URL if necessary
dataset/ETHPy150Open huntrar/scrape/scrape/utils.py/clean_url