Ejemplo n.º 1
0
 def Match(self, path):
     response = self._session.post(
         'https://sheriff-config-dot-chromeperf.appspot.com/subscriptions/match',
         json={'path': path})
     if not response.ok:
         return None, '%r\n%s' % (response, response.text)
     match = json_format.Parse(response.text,
                               sheriff_config_pb2.MatchResponse())
     return [
         self._ParseSubscription(s.revision, s.subscription)
         for s in match.subscriptions
     ], None
 def Match(self, path, check=False):
     response = self._session.post(
         'https://sheriff-config-dot-chromeperf.appspot.com/subscriptions/match',
         json={'path': path})
     if response.status_code == 404:  # If no subscription matched
         return [], None
     if not response.ok:
         err_msg = '%r\n%s' % (response, response.text)
         if check:
             raise InternalServerError(err_msg)
         return None, err_msg
     match_resp = json_format.Parse(response.text,
                                    sheriff_config_pb2.MatchResponse())
     return [
         self._ParseSubscription(s.revision, s.subscription)
         for s in match_resp.subscriptions
     ], None