Example #1
0
    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)
Example #2
0
    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)
Example #3
0
    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)
Example #4
0
    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)