示例#1
0
    def http_get(self, payload):
        sp_logger.info("Sending GET request to {}...".format(self.endpoint))
        sp_logger.debug("Payload: {}".format(payload))
        r = requests.get(self.endpoint, params=payload, timeout=5.0)

        msg = "GET request finished with status code: " + str(r.status_code)
        if self.is_good_status_code(r.status_code):
            sp_logger.info(msg)
        else:
            sp_logger.warning(msg)
        return r
示例#2
0
 def _log_result(self, request, status_code):
     msg = f"{request} request finished with status code: {status_code}"
     if self.is_good_status_code(status_code):
         sp_logger.info(msg)
     else:
         sp_logger.warning(msg)
示例#3
0
 def _log_request(self, request, payload):
     sp_logger.info(f"Sending {request} request to {self.endpoint}...")
     sp_logger.debug(f"Payload: {payload}")