Lookup the given url and return an entry if found. Else return None.
        The returned entry is a dict with metadata about the content and a 'content' key with a file path value

        :param url:
        :return:
166111
def get(self, url):
        
        self._load(url)
        self._flush()

        return self.metadata[url]
373976
def url(self, version=None, **kwargs):
        """"""
        for url in self.urls(version):
            if [key for key in kwargs.keys() if not '{' + key + '}' in url]:
                continue

            return url.format(**kwargs)

        raise KeyError('URL that takes all provided parameters not found')
681994
def parse_url(url, warning=True):
    
    parsed = urllib_parse.urlparse(url)
    query = urllib_parse.parse_qs(parsed.query)
    is_gdrive = parsed.hostname == 'drive.google.com'
    is_download_link = parsed.path.endswith('/uc')

    file_id = None
    if is_gdrive and 'id' in query:
        file_ids = query['id']
        if len(file_ids) == 1:
            file_id = file_ids[0]
    match = re.match(r'^/file/d/(.*?)/view$', parsed.path)
    if match:
        file_id = match.groups()[0]

    if is_gdrive and not is_download_link:
        warnings.warn(
            'You specified Google Drive Link but it is not the correct link '
            "to download the file. Maybe you should try: {url}"
            .format(url='https://drive.google.com/uc?id={}'.format(file_id))
        )

    return file_id, is_download_link
179623
def parse_resource_from_url(self, url):
        
        # special case for the api root
        if url == '/api':
            return 'api'
        elif url == '/katello':
            return 'katello'

        match = self.resource_pattern.match(url)
        if match:
            return match.groupdict().get('resource', None)
15669
def _urlparse(path):
    
    url = urlparse.urlparse(path)
    _validate_url(url)
    if not url.scheme or url.scheme == 'file://':
        # Normalize path, and set scheme to "file" if missing
        path = os.path.abspath(
            os.path.expanduser(path))
        url = urlparse.urlparse('file://'+path)
    return url
347943
def get_url(url: str) -> Union[dict, int, float, str]:
        ''''''

        request = Request(url, headers={"User-Agent": "pypeerassets"})
        response = cast(HTTPResponse, urlopen(request))
        if response.status != 200:
            raise Exception(response.reason)
        return json.loads(response.read().decode())
613275
def _extractPathFromUrl(url):
        
        if url.netloc != '' and url.netloc != 'localhost':
            raise RuntimeError("The URL '%s' is invalid" % url.geturl())
        return url.netloc + url.path
48670
def lookup_url(self, url):
        """"""
        if type(url) is not str:
            url = url.encode('utf8')
        if not url.strip():
            raise ValueError("Empty input string.")
        url_hashes = URL(url).hashes
        try:
            list_names = self._lookup_hashes(url_hashes)
            self.storage.commit()
        except Exception:
            self.storage.rollback()
            raise
        if list_names:
            return list_names
        return None
864240
def path2url(p):
    
    # Python 3 is a bit different and does a better job.
    if sys.version_info.major >= 3 and sys.version_info.minor >= 4:
        import pathlib
        return pathlib.Path(p).as_uri()
    else:
        return six.moves.urllib.parse.urljoin(
            'file:', six.moves.urllib.request.pathname2url(p)
        )
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)))
522129
def open(self, url):
        
        protocol, location = self.split(url)
        if protocol == self.protocol:
            return self.find(location)
        else:
            return None
731821
def with_url(self, url):
        
        self.url = URL(url)
        self.header["Host"] = self.url.host
        return self
639413
def _download_from_url(self, url):
        
        ext = get_file_extension(url)
        if "?" in url:
            ext = get_file_extension(os.path.splitext(url.split("?")[0]))
        filepath = "/tmp/%s.%s" % (uuid.uuid4().hex, ext)
        request.urlretrieve(url, filepath)
        return filepath
47441
def get_url(self, filename, query_para=None, **url_args):
        
        from uliweb.core.html import Tag
        
        title = url_args.pop('title', filename)
        text = url_args.pop('text', title)
        query_para = query_para or {}
        return str(Tag('a', title, href=self.get_href(filename, **query_para), **url_args))
932821
def _get(url):
    
    if PYTHON_3:
        req = request.Request(url, headers=HEADER)
        response = request.urlopen(req)
        return response.read().decode('utf-8')
    else:
        req = urllib2.Request(url, headers=HEADER)
        response = urllib2.urlopen(req)
        return response.read()
295667
def get_url(self, url_or_dict):
        
        if isinstance(url_or_dict, basestring):
            url_or_dict = {'viewname': url_or_dict}
        try:
            return reverse(**url_or_dict)
        except NoReverseMatch:
            if MENU_DEBUG:
                print >>stderr,'Unable to reverse URL with kwargs %s' % url_or_dict
354081
def get(url, last_modified=None):
    
    try:
        with closing(urllib2.urlopen(url)) as page:
            if last_modified is not None:
                last_mod = dateutil.parser.parse(dict(page.info())['last-modified'])
                if last_mod <= last_modified:
                    return ""
            return page.read()
    except urllib2.URLError:
        return ""