'>>> url = URL(\'http://www.google.com\')
>>> r = HTTPResponse(200, \'\' , Headers(), url, url)
>>> r.set_url(\'http://www.google.com/\')
Traceback (most recent call last):
TypeError: The URL of a HTTPResponse object must be of url.URL type.
>>> r.set_url(url)
>>> r.get_url() == url
True'

def set_url(self, url):

    if (not isinstance(url, URL)):
        raise TypeError('The    URL    of    a    HTTPResponse    object    must    be    of    url.URL    type.')
    self._realurl = url.uri2url()
