response = utils.fetch_url(f"{base_url}/{block['csv_url']}", network.web_headers, (config.get("connection_timeout"), config.get("read_timeout")))
logger.debug("response.ok='%s',response.status_code=%d,response.content()=%d", response.ok, response.status_code, len(response.content))
- if not response.ok or response.status_code >= 300 or response.content == "":
+ if not response.ok or response.status_code > 200 or response.content == "":
logger.warning("Could not fetch csv_url='%s' for blocker='%s' - SKIPPED!", block["csv_url"], block["blocker"])
continue
)
logger.debug("response.ok='%s',response.status_code=%d,response.text()=%d", response.ok, response.status_code, len(response.text))
- if not response.ok or response.status_code >= 300 or len(response.content) == 0:
+ if not response.ok or response.status_code > 200 or len(response.content) == 0:
logger.warning("Failed fetching url='%s': response.ok='%s',response.status_code=%d,response.content()=%d - EXIT!", url, response.ok, response.status_code, len(response.text))
return 1
logger.debug("response[]='%s' - CALLED!", type(response))
if not isinstance(response, requests.models.Response):
raise ValueError(f"Parameter response[]='{type(response)}' is not type of 'Response'")
- elif not response.ok or response.status_code >= 300:
+ elif not response.ok or response.status_code > 200:
raise ValueError(f"response.ok='{response.ok}',response.status_code={response.status_code},response.reason='{response.reason}' but function was invoked")
elif response.text.strip() != "" and response.headers.get("content-type") is not None and response.headers.get("content-type").split(";")[0] not in ["*/*", "application/json", "application/jrd+json", "application/activity+json"]:
logger.warning("response.headers[content-type]='%s' is not a JSON type, below json() invocation may raise an exception", response.headers.get("content-type"))
json_reply["json"] = json_helper.from_response(response)
logger.debug("response.ok='%s',response.status_code=%d,response.text()=%d", response.ok, response.status_code, len(response.text))
- if not response.ok or response.status_code >= 300 or len(response.text.strip()) == 0:
+ if not response.ok or response.status_code > 200 or len(response.text.strip()) == 0:
logger.debug("Cannot query JSON API: domain='%s',path='%s',data()=%d,response.status_code=%d,response.text()=%d", domain, path, len(data), response.status_code, len(response.text))
json_reply["status_code"] = response.status_code
json_reply["error_message"] = response.reason
json_reply["json"] = json_helper.from_response(response)
logger.debug("response.ok='%s',response.status_code='%s',response.text()=%d", response.ok, response.status_code, len(response.text))
- if not response.ok or response.status_code >= 300 or len(response.text) == 0:
+ if not response.ok or response.status_code > 200 or len(response.text) == 0:
logger.warning("Cannot query JSON API: url='%s',response.status_code=%d,response.text()=%d", url, response.status_code, len(response.text))
json_reply["status_code"] = response.status_code
json_reply["error_message"] = response.reason
json_reply["json"] = json_helper.from_response(response)
logger.debug("response.ok='%s',response.status_code=%d,response.text()=%d", response.ok, response.status_code, len(response.text))
- if not response.ok or response.status_code >= 300 or len(response.text) == 0:
+ if not response.ok or response.status_code > 200 or len(response.text) == 0:
logger.debug("Cannot query JSON API: domain='%s',path='%s',response.status_code=%d,response.text()=%d", domain, path, response.status_code, len(response.text))
json_reply["status_code"] = response.status_code
json_reply["error_message"] = response.reason