Exemplo n.º 1
0
 def _CheckHiddenProperty(self, prop):
     # pylint:disable=protected-access
     value = properties._GetPropertyWithoutCallback(prop,
                                                    self._properties_file)
     if value is not None:
         msg = '[{0}]'.format(prop.name)
         return check_base.Failure(message=msg)
Exemplo n.º 2
0
def CheckURLHttplib2(url):
    try:
        http.Http(timeout=_NETWORK_TIMEOUT).request(url, method='GET')
    except (http_client.HTTPException, socket.error, ssl.SSLError,
            httplib2.HttpLib2Error, socks.HTTPError) as err:
        msg = 'httplib2 cannot reach {0}:\n{1}\n'.format(url, err)
        return check_base.Failure(message=msg, exception=err)
Exemplo n.º 3
0
 def _CheckURL(self, url):
     try:
         http.Http().request(url, method='GET')
     # TODO(b/29218762): Investigate other possible exceptions.
     except (httplib.HTTPException, socket.error, ssl.SSLError,
             httplib2.HttpLib2Error, socks.HTTPError) as err:
         msg = 'Cannot reach {0} ({1})'.format(url, type(err).__name__)
         return check_base.Failure(message=msg, exception=err)
Exemplo n.º 4
0
 def _CheckURLRequests(self, url):
     try:
         core_requests.GetSession().request('GET', url)
     except requests.exceptions.RequestException as err:
         msg = 'Cannot reach {0} with requests ({1})'.format(
             url,
             type(err).__name__)
         return check_base.Failure(message=msg, exception=err)
Exemplo n.º 5
0
 def _CheckURLHttplib2(self, url):
     try:
         http.Http().request(url, method='GET')
     except (http_client.HTTPException, socket.error, ssl.SSLError,
             httplib2.HttpLib2Error, socks.HTTPError) as err:
         msg = 'Cannot reach {0} with httplib2 ({1})'.format(
             url,
             type(err).__name__)
         return check_base.Failure(message=msg, exception=err)
Exemplo n.º 6
0
    def _CheckHiddenProperty(self, prop):
        if str(prop) in self._WHITELIST:
            return
        if not self.ignore_hidden_property_whitelist and \
            str(prop) in self.whitelist:
            return

        # pylint:disable=protected-access
        value = properties._GetPropertyWithoutCallback(prop,
                                                       self._properties_file)
        if value is not None:
            msg = '[{0}]'.format(prop)
            return check_base.Failure(message=msg)
Exemplo n.º 7
0
    def _CheckHiddenProperty(self, prop):
        if six.text_type(prop) in self._ALLOWLIST:
            return
        if (not self.ignore_hidden_property_allowlist
                and six.text_type(prop) in self.allowlist):
            return

        # pylint:disable=protected-access
        value = properties._GetPropertyWithoutCallback(prop,
                                                       self._properties_file)
        if value is not None:
            msg = '[{0}]'.format(prop)
            return check_base.Failure(message=msg)
 def CreateFailure(url, err):
   msg = 'Cannot reach {0} ({1})'.format(url, type(err).__name__)
   return check_base.Failure(message=msg, exception=err)
 def CreateFailure(prop):
     msg = '[{0}]'.format(prop)
     return check_base.Failure(message=msg)
Exemplo n.º 10
0
def CheckURLRequests(url):
    try:
        core_requests.GetSession(timeout=_NETWORK_TIMEOUT).request('GET', url)
    except requests.exceptions.RequestException as err:
        msg = 'requests cannot reach {0}:\n{1}\n'.format(url, err)
        return check_base.Failure(message=msg, exception=err)