Given a url remove the fragment and the authentication part.

    :rtype: str
192435
def urldefragauth(url):
    
    scheme, netloc, path, params, query, fragment = urlparse(url)

    # see func:`prepend_scheme_if_needed`
    if not netloc:
        netloc, path = path, netloc

    netloc = netloc.rsplit('@', 1)[-1]

    return urlunparse((scheme, netloc, path, params, query, ''))
1324427
def clean_url(self):
        
        url = self.cleaned_data['url']

        if url:
            pattern = re.compile(r'https?://(www\.)?instagr(\.am|am\.com)/p/\S+')
            if not pattern.match(url):
                raise forms.ValidationError('Please provide a valid instagram link.')

        return url
533829
def clear(self, url=None, xpath=None):
        
        if url is not None:
            query = self._query(url, xpath)
            if query.count() > 0:
                query.delete()
                self.session.commit()
            else:
                raise KeyError("Cannot clear URL, not in cache: " + str(url) + " xpath:" + str(xpath))
        else:
            # remove the DB file
            self.close()
            if path.exists(self.db_path):
                remove(self.db_path)
1231929
def remove(cls, user, automation, api=None):
        
        user = Transform.to_user(user)
        automation = Transform.to_automation(automation)

        api = api or cls._API
        api.delete(
            cls._URL['get'].format(automation_id=automation, id=user)
        )
762119
def _replace(self, url):
        
        segments = url.split('/')
        if segments[0] == '':
            root = self.rootURL(self.request)
            if segments[1] == 'Mantissa':
                root = root.child('static').child('mantissa-base')
                segments = segments[2:]
            elif segments[1] in self.installedOfferingNames:
                root = root.child('static').child(segments[1])
                segments = segments[2:]
            for seg in segments:
                root = root.child(seg)
            return str(root)
        return url
171578
def sanitize_url(url):
    """"""
    parts = urlparse(url)
    if parts.password is None:
        return url
    host_info = parts.netloc.rsplit('@', 1)[-1]
    parts = parts._replace(netloc='{}:{}@{}'.format(
        parts.username, REDACTED, host_info))
    return parts.geturl()
563444
def should_strip_auth(self, old_url, new_url):
        """"""
        old_parsed = urlparse(old_url)
        new_parsed = urlparse(new_url)
        if old_parsed.hostname != new_parsed.hostname:
            return True
        # Special case: allow http -> https redirect when using the standard
        # ports. This isn't specified by RFC 7235, but is kept to avoid
        # breaking backwards compatibility with older versions of requests
        # that allowed any redirects on the same host.
        if (old_parsed.scheme == 'http' and old_parsed.port in (80, None)
                and new_parsed.scheme == 'https' and new_parsed.port in (443, None)):
            return False

        # Handle default port usage corresponding to scheme.
        changed_port = old_parsed.port != new_parsed.port
        changed_scheme = old_parsed.scheme != new_parsed.scheme
        default_port = (DEFAULT_PORTS.get(old_parsed.scheme, None), None)
        if (not changed_scheme and old_parsed.port in default_port
                and new_parsed.port in default_port):
            return False

        # Standard case: root URI must match
        return changed_port or changed_scheme
896813
protected String removeQueryAndFragment(String url) {
        if (url == null) {
            return url;
        }
        String cleanUrl = url;

        int queryIndex = url.indexOf("?");
        int fragmentIndex = url.indexOf("#");
        if (queryIndex > 0) {
            if (fragmentIndex > 0 && fragmentIndex < queryIndex) {
                // Found fragment before the query string; remove everything after fragment
                cleanUrl = url.substring(0, fragmentIndex);
            } else {
                // Didn't find fragment or fragment is after query string; remove everything after query string
                cleanUrl = url.substring(0, queryIndex);
            }
        } else if (fragmentIndex > 0) {
            // No query string, but did find a fragment
            cleanUrl = url.substring(0, fragmentIndex);
        }
        return cleanUrl;
    }
181354
def strip_bewit(url):
    
    m = re.search('[?&]bewit=([^&]+)', url)
    if not m:
        raise InvalidBewit('no bewit data found')
    bewit = m.group(1)
    stripped_url = url[:m.start()] + url[m.end():]
    return bewit, stripped_url
731208
def delete(self, url, data=None, params=None):
        
        return self.request("delete", url, data, params)
958384
def remove_authentication(self, auth_name=None, organization=None):
        
        if auth_name:
            if organization:
                url = '%s/authentications/org/%s/name/%s' % (self.domain, organization, auth_name)
            else:
                url = '%s/authentications/name/%s' % (self.domain, auth_name)
        else:
            url = '%s/authentications' % (self.domain,)

        res = self.session.delete(url)
        self._check_response(res, [201])
1308578
def _strip_auth(self, proc_params):
        """"""
        params = proc_params.copy()
        params.pop("auth", None)
        params.pop("clusterAuthMode", None)
        return params
1259727
def url_to_parts(url):
    

    if not url:
        return None

    scheme, netloc, path, query, fragment = _urlsplit(url)

    if not path or path == '/':
        path = []
    else:
        path = path.strip('/').split('/')

    if not query:
        query = {}
    else:
        query = _parse_qs(query)

    return _urllib_parse.SplitResult(scheme, netloc, path, query, fragment)
818284
def normaliseURL(url):
    
    url = unicode_safe(url).strip()
    # XXX: brutal hack
    url = unescape(url)

    pu = list(urlparse(url))
    segments = pu[2].split('/')
    while segments and segments[0] in ('', '..'):
        del segments[0]
    pu[2] = '/' + '/'.join(segments)
    # remove leading '&' from query
    if pu[4].startswith('&'):
        pu[4] = pu[4][1:]
    # remove anchor
    pu[5] = ""
    return urlunparse(pu)
1025273
def clean_url(url):
    
    parsed = urlparse(url.strip())
    reconstructed = ParseResult(
        parsed.scheme, parsed.netloc, parsed.path,
        params='', query='', fragment='')
    return reconstructed.geturl()
1159713
def _strip_schema(url):
    """"""
    result = parse_url(url, allow_fragments=False)
    return result.netloc + result.path
490874
def delete_host_from_segment(ipaddress, networkaddress, auth, url):
    '''

    '''
    host_id = get_host_id(ipaddress, networkaddress, auth, url)
    remove_scope_ip(host_id, auth.creds, auth.url)