def __init__(self, url=None): self._httpobj = httplib2.Http() # Force 4xx/5xx httplib exceptions to be ignored self._httpobj.force_exception_to_status_code = True self.protocol, self.server = parse_url(url) if url else (None, None)
def test_parse_url_valid_url(self): """ Test that a valid URL is parsed into a protocol and server """ test_urls = { "http://test.com": ("http", "test.com"), "http://test.com:80": ("http", "test.com:80"), "https://test.com": ("https", "test.com"), "https://test.com:443": ("https", "test.com:443") } for url, parts in test_urls.items(): self.assertEqual(parse_url(url), parts)