Example #1
0
    def urlopen(self, url, **kwargs):
        """Returns a RORemoteFile instance.

        Invoked by the CustomMirrorGroup object.
        url is a list with 3 elements: url[0] the host,
        url[1] the path and url[2] optional query parameters.

        Keyword arguments:
        **kwargs -- kwargs are ignored

        """
        host, path, query = url
        f = None
        try:
            f = RORemoteFile(path, apiurl=host, lazy_open=False, **query)
        except HTTPError as e:
            if f is not None:
                f.close()
            exc = grabber.URLGrabError(14, str(e))
            exc.orig_exc = e
            raise exc
        return f
Example #2
0
    def urlopen(self, url, **kwargs):
        """Returns a RORemoteFile instance.

        Invoked by the CustomMirrorGroup object.
        url is a list with 3 elements: url[0] the host,
        url[1] the path and url[2] optional query parameters.

        Keyword arguments:
        **kwargs -- kwargs are ignored

        """
        host, path, query = url
        f = None
        try:
            f = RORemoteFile(path, apiurl=host, lazy_open=False, **query)
        except HTTPError as e:
            if f is not None:
                f.close()
            exc = grabber.URLGrabError(14, str(e))
            exc.orig_exc = e
            raise exc
        return f
Example #3
0
 def test_remotefile7(self):
     """test lazy_open=False"""
     # directly open the url (even if no read request is issued)
     f = RORemoteFile('/path/to/file', lazy_open=False)
     f.close()
Example #4
0
 def test_remotefile6(self):
     """test lazy_open=True (default)"""
     # the url is opened lazily (that is when a read request is issued)
     f = RORemoteFile('/path/to/file', lazy_open=True)
     f.close()
Example #5
0
 def test_remotefile7(self):
     """test lazy_open=False"""
     # directly open the url (even if no read request is issued)
     f = RORemoteFile('/path/to/file', lazy_open=False)
     f.close()
Example #6
0
 def test_remotefile6(self):
     """test lazy_open=True (default)"""
     # the url is opened lazily (that is when a read request is issued)
     f = RORemoteFile('/path/to/file', lazy_open=True)
     f.close()