Get the subdomain of the given URL.

        Args:
            url (str): The URL to get the subdomain from.

        Returns:
            str: The subdomain(s)
426724
def get_subdomain(url):
        

        if url not in URLHelper.__cache:
            URLHelper.__cache[url] = urlparse(url)

        return ".".join(URLHelper.__cache[url].netloc.split(".")[:-2])
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)
1179396
def parse(url):
    
    parts = split(url)
    if parts.scheme:
        username, password, host, port = split_netloc(parts.netloc)
        subdomain, domain, tld = split_host(host)
    else:
        username = password = subdomain = domain = tld = port = ''
    return URL(parts.scheme, username, password, subdomain, domain, tld,
               port, parts.path, parts.query, parts.fragment, url)
814668
def get_domain(self):
        
        if hasattr(self, 'domain'):
            return Domain(self.rest_client.make_request(self.domain), self.rest_client)
975633
def get_url_for_get(url, parameters=None):
        # type: (str, Optional[Dict]) -> str
        
        spliturl = urlsplit(url)
        getparams = OrderedDict(parse_qsl(spliturl.query))
        if parameters is not None:
            getparams.update(parameters)
        spliturl = spliturl._replace(query=urlencode(getparams))
        return urlunsplit(spliturl)
453
def url(self, url):
        
        if url is None:
            return
        el_FLocat = self._el.find('mets:FLocat', NS)
        if el_FLocat is None:
            el_FLocat = ET.SubElement(self._el, TAG_METS_FLOCAT)
        el_FLocat.set("{%s}href" % NS["xlink"], url)
1307544
def get_host(self, domain_part):
        
        if self.map.host_matching:
            if domain_part is None:
                return self.server_name
            return to_unicode(domain_part, 'ascii')
        subdomain = domain_part
        if subdomain is None:
            subdomain = self.subdomain
        else:
            subdomain = to_unicode(subdomain, 'ascii')
        return (subdomain and subdomain + u'.' or u'') + self.server_name
504479
def parse_url(url):
    
    try:
        url = unicode(url)
    except UnicodeDecodeError:
        pass

    if py3k:
        make_utf8 = lambda x: x
    else:
        make_utf8 = lambda x: isinstance(x, unicode) and x.encode('utf-8') or x

    if '://' in url:
        scheme, url = url.split('://', 1)
    else:
        scheme = 'http'
    url = 'http://' + url
    parsed = urlparse.urlsplit(url)
    r = ObjectDict()
    r['scheme'] = make_utf8(scheme)
    r['netloc'] = make_utf8(parsed.netloc)
    r['path'] = make_utf8(parsed.path)
    r['query'] = make_utf8(parsed.query)
    r['fragment'] = make_utf8(parsed.fragment)
    r['uri'] = make_utf8(parsed.path)
    if parsed.query:
        r['uri'] += '?' + make_utf8(parsed.query)
    r['username'] = make_utf8(parsed.username)
    r['password'] = make_utf8(parsed.password)
    host = make_utf8(parsed.hostname.encode('idna').decode('utf-8'))
    r['host'] = r['hostname'] = host
    try:
        r['port'] = parsed.port
    except ValueError:
        r['port'] = None
    if r['port']:
        r['http_host'] = '%s:%d' % (r['host'], r['port'])
    else:
        r['http_host'] = r['host']

    return r
560421
def subdomain(self, index, value=None):
        
        if value is not None:
            subdomains = self.subdomains()
            subdomains[index] = value
            return URL._mutate(self, host='.'.join(subdomains))
        return self.subdomains()[index]
509112
def get_domain_home_from_url(url):
    
    p = parse.urlparse(url)
    if p.netloc:
        return '{}://{}'.format(p.scheme, p.netloc), p.netloc
    else:
        return '', ''
1353072
def get_host(url):
    
    p = parse_url(url)
    return p.scheme or 'http', p.hostname, p.port
1155570
def url(self) -> str:
        
        url_str = self.parse_url.path or ""
        if self.parse_url.querystring is not None:
            url_str += "?" + self.parse_url.querystring
        return url_str
1273141
def subdomains(self, value=None):
        
        if value is not None:
            return URL._mutate(self, host='.'.join(value))
        return self.host().split('.')
1334423
def _get_url_base(cls, url):
        
        s = urlsplit(url)
        return urlunsplit([s.scheme, s.netloc, '', '', ''])
340715
def get(self, url):
        
        r = requests.get(self._format_url(url), headers=self.headers, timeout=TIMEOUT)
        self._check_response(r, 200)

        return r.json()
1006222
def parse_domain(url):
    
    domain_match = lib.DOMAIN_REGEX.match(url)
    if domain_match:
        return domain_match.group()
747917
def parse(url):
    
    result = urlparse.urlparse(nstr(url))

    path = result.scheme + '://' + result.netloc
    if result.path:
        path += result.path

    query = {}

    # extract the python information from the query
    if result.query:
        url_query = urlparse.parse_qs(result.query)
        for key, value in url_query.items():
            if type(value) == list and len(value) == 1:
                value = value[0]

            query[key] = value

    return path, query, result.fragment