resolve the search url no matter if local or remote.
        :return: url or exception
974719
def get_search_url(self):
        

        if self.is_remote:
            return self.url

        return reverse('search_api', args=[self.slug])
1246991
def check_connection (self):
        
        if (self.parent_url is not None and
           not self.parent_url.startswith(u"file:")):
            msg = _("local files are only checked without parent URL or when the parent URL is also a file")
            raise LinkCheckerError(msg)
        if self.is_directory():
            self.set_result(_("directory"))
        else:
            url = fileutil.pathencode(self.url)
            self.url_connection = urlopen(url)
            self.check_case_sensitivity()
150952
def fetch(self, url):
        
        try:
            r = requests.get(url, timeout=self.timeout)
        except requests.exceptions.Timeout:
            if not self.safe:
                raise
            else:
                return None
        
        # Raise 404/500 error if any
        if r and not self.safe:
            r.raise_for_status()
        
        return r.text
409606
def open_remote_url(urls, **kwargs):
    
    if isinstance(urls, str):
        urls = [urls]
    for url in urls:
        try:
            web_file = requests.get(url, stream=True, **kwargs)
            if 'html' in web_file.headers['content-type']:
                raise ValueError("HTML source file retrieved.")
            return web_file
        except Exception as ex:
            logger.error('Fail to open remote url - {}'.format(ex))
            continue
361791
def resolve_url(href_str, absolute_url_str)
      if absolute_url_str.class <= URI::Generic
        absolute_url = absolute_url_str.dup
      else
        begin
          absolute_url = URI(absolute_url_str).dup
        rescue URI::InvalidURIError
          raise ArgumentError, "#{absolute_url_str} must be represent a valid relative or absolute URI" 
        end
      end
      raise ArgumentError, "#{absolute_url} must be absolute" unless absolute_url.absolute?
      if href_str.class <= URI::Generic
        href = href_str.dup
      else
        begin
          href = URI(href_str).dup
        rescue URI::InvalidURIError
          raise ArgumentError, "#{href_str} must be represent a valid relative or absolute URI"
        end
      end

      # return :href if :href is already absolute
      return href.to_s if href.absolute?

      #TODO: edge cases, see [issue #8](https://github.com/propublica/upton/issues/8)
      URI.join(absolute_url.to_s, href.to_s).to_s
    end
369627
def request_uri(self):
        """"""
        uri = self.path or '/'

        if self.query is not None:
            uri += '?' + self.query

        return uri
474146
def found_url(self, url, name, base):
        """"""
        assert isinstance(url, unicode) or url is None, repr(url)
        self.callback(url, line=self.parser.last_lineno(),
                      column=self.parser.last_column(), name=name, base=base)
525169
def _get_url(url):
        
        if isinstance(url, urlparse.ParseResult):
            return urlparse.urlunparse(url)
        else:
            return url
1027876
def get(self, urls=None, **overrides):
        """"""
        if urls is not None:
            overrides['urls'] = urls
        return self.where(accept='GET', **overrides)
1117213
function resolveLocal(success, fail, request, options) {
    var path = localPath + request.substring(8);
    resolve(success, fail, path, window.PERSISTENT, UNSANDBOXED, options);
}
617876
def resolving(self, ref):
        

        url, resolved = self.resolve(ref)
        self.push_scope(url)
        try:
            yield resolved
        finally:
            self.pop_scope()
79691
def do(self):
        ""
        _PR = urlparse(self.url)
        return _PR.scheme, _PR.netloc, _PR.path, _PR.params, _PR.query, _PR.fragment
205543
def geturl(self):
        
        if self.retries is not None and len(self.retries.history):
            return self.retries.history[-1].redirect_location
        else:
            return self._request_url
860296
def _get_url_doc(self):
        
        resolver = get_resolver(None)
        possibilities = resolver.reverse_dict.getlist(self)
        urls = [possibility[0] for possibility in possibilities]
        return urls
461789
def resolve_url(self, catalog_url):
        
        if catalog_url != '':
            resolver_base = catalog_url.split('catalog.xml')[0]
            resolver_url = resolver_base + self.url_path
            resolver_xml = session_manager.urlopen(resolver_url)
            tree = ET.parse(resolver_xml)
            root = tree.getroot()
            if 'name' in root.attrib:
                self.catalog_name = root.attrib['name']
            else:
                self.catalog_name = 'No name found'
            resolved_url = ''
            found = False
            for child in root.iter():
                if not found:
                    tag_type = child.tag.split('}')[-1]
                    if tag_type == 'dataset':
                        if 'urlPath' in child.attrib:
                            ds = Dataset(child)
                            resolved_url = ds.url_path
                            found = True
            if found:
                return resolved_url
            else:
                log.warning('no dataset url path found in latest.xml!')
1002386
def get_url(self, name, view_name, kwargs, request):
        

        # Return None if the view name is not supplied
        if not view_name:
            return None

        # Return the hyperlink, or error if incorrectly configured.
        try:
            url = self.reverse(view_name, kwargs=kwargs, request=request)
        except NoReverseMatch:
            msg = (
                'Could not resolve URL for hyperlinked relationship using '
                'view name "%s". You may have failed to include the related '
                'model in your API, or incorrectly configured the '
                '`lookup_field` attribute on this field.'
            )
            raise ImproperlyConfigured(msg % view_name)

        if url is None:
            return None

        return Hyperlink(url, name)
45579
def resolve(track_url):
    
    try:
        path = urlparse.urlparse(track_url).path
        tracks = client.get('/tracks', q=path)

        if tracks:
            return tracks[0]
        else:
            raise ValueError('Track not found for URL {}'.format(track_url))
    except Exception as e:
        raise ValueError('Error obtaining track by url: {}'.format(str(e)))