data=data,
headers={**api_headers, **headers},
timeout=(config.get("connection_timeout"), config.get("read_timeout")),
- cookies=cookies.get_all(domain) if cookies.has(domain) else dict(),
+ cookies=cookies.get_all(domain),
allow_redirects=False
)
logger.debug("Parsing JSON response from domain='%s',path='%s' ...", domain, path)
json_reply["json"] = json_helper.from_response(response)
- logger.debug("response.ok='%s',response.status_code=%d,json_reply[]='%s'", response.ok, response.status_code, type(json_reply))
- if not response.ok or response.status_code >= 400 or len(json_reply["json"]) == 0:
- logger.warning("Cannot query JSON API: domain='%s',path='%s',data()=%d,response.status_code=%d,json_reply[]='%s'", domain, path, len(data), response.status_code, type(json_reply))
+ 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:
+ logger.warning("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
instances.set_last_error(domain, response)
logger.debug("Parsing JSON response from url='%s' ...", url)
json_reply["json"] = json_helper.from_response(response)
- logger.debug("response.ok='%s',response.status_code='%s',json_reply[]='%s'", response.ok, response.status_code, type(json_reply))
- if not response.ok or response.status_code >= 400 or len(json_reply["json"]) == 0:
- logger.warning("Cannot query JSON API: url='%s',response.status_code=%d,json_reply[]='%s'", url, response.status_code, type(json_reply))
+ logger.debug("response.ok='%s',response.status_code='%s',response.text()=%d", response.ok, response.status_code, len(response.text), response.text)
+ if not response.ok or response.status_code >= 300 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
del json_reply["json"]
f"https://{domain}{path}",
headers={**api_headers, **headers},
timeout=timeout,
- cookies=cookies.get_all(domain) if cookies.has(domain) else {},
+ cookies=cookies.get_all(domain),
allow_redirects=False
)
logger.debug("Parsing JSON response from domain='%s',path='%s' ...", domain, path)
json_reply["json"] = json_helper.from_response(response)
- logger.debug("response.ok='%s',response.status_code=%d,json_reply[]='%s'", response.ok, response.status_code, type(json_reply))
- if not response.ok or response.status_code >= 400 or len(json_reply["json"]) == 0:
- logger.warning("Cannot query JSON API: domain='%s',path='%s',response.status_code=%d,json_reply[]='%s'", domain, path, response.status_code, type(json_reply))
+ 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:
+ logger.warning("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
- del json_reply["json"]
instances.set_last_error(domain, response)
+ del json_reply["json"]
logger.debug("Returning json_reply(%d)[]='%s' - EXIT!", len(json_reply), type(json_reply))
return json_reply
f"https://{domain}{path}",
headers=headers,
timeout=timeout,
- cookies=cookies.get_all(domain) if cookies.has(domain) else {},
+ cookies=cookies.get_all(domain),
allow_redirects=False
)