def fetch(self, url, callback=None, raise_error=True, **kwargs):
        """  Fetch the given url and fire the callback when ready. Optionally
        pass a `streaming_callback` to handle data from large requests.
        
        Parameters
        ----------
            url: string
                The url to access.
            callback: callable
                The callback to invoke when the request completes. You can
                also use the return value.
            kwargs: 
                The arguments to pass to the `HttpRequest` object. See it
                for which values are valid.
        
        Returns
        --------
            result: Future
                A future that resolves with the `HttpResponse` object when
                the request is complete.

        """
        app = BridgedApplication.instance()
        f = app.create_future()

        #: Set callback for when response is in
        if callback is not None:
            f.then(callback)

        def handle_response(response):
            """ Callback when the request is complete. """
            self.requests.remove(response.request)
            f.set_result(response)

        #: Create and dispatch the request object
        request = self.request_factory(url=url,
                                       callback=handle_response,
                                       **kwargs)

        #: Save a reference
        #: This gets removed in the handle response
        self.requests.append(request)

        #: Run the request
        self._fetch(request)

        #: Save it on the future so it can be accessed and observed
        #: from a view if needed
        f.request = request
        return f
def fetch ( self , url , callback = None , raise_error = True , ** kwargs ) : app = BridgedApplication . instance ( ) f = app . create_future ( ) if callback is not None : f . then ( callback ) def handle_response ( response ) : self . requests . remove ( response . request ) f . set_result ( response ) request = self . request_factory ( url = url , callback = handle_response , ** kwargs ) self . requests . append ( request ) self . _fetch ( request ) f . request = request return f
Fetch the given url and fire the callback when ready. Optionally
        pass a `streaming_callback` to handle data from large requests.
        
        Parameters
        ----------
            url: string
                The url to access.
            callback: callable
                The callback to invoke when the request completes. You can
                also use the return value.
            kwargs: 
                The arguments to pass to the `HttpRequest` object. See it
                for which values are valid.
        
        Returns
        --------
            result: Future
                A future that resolves with the `HttpResponse` object when
                the request is complete.