c32f47aea657b887c12560a92d691c6fd7f6a311,homeassistant/components/notify/ios.py,iOSNotificationService,send_message,#iOSNotificationService#Any#,47
Before Change
elif req.status_code is 400 or 500:
_LOGGER.error(message)
if req.status_code in (201, 429):
rate_limits = req.json()["rateLimits"]
resetsAt = dt_util.parse_datetime(rate_limits["resetsAt"])
resetsAtTime = resetsAt - datetime.now(timezone.utc)
rate_limit_msg = ("iOS push notification rate limits for %s: "
"%d sent, %d allowed, %d errors, "
"resets in %s")
_LOGGER.info(rate_limit_msg,
ios.device_name_for_push_id(target),
rate_limits["successful"],
rate_limits["maximum"], rate_limits["errors"],
str(resetsAtTime).split(".")[0])
After Change
req = requests.post(PUSH_URL, json=data, timeout=10)
if req.status_code != 201:
fallback_error = req.json().get("errorMessage",
"Unknown error")
fallback_message = ("Internal server error, "
"please try again later: "
"{}").format(fallback_error)
message = req.json().get("message", fallback_message)
if req.status_code == 429:
_LOGGER.warning(message)
log_rate_limits(target, req.json(), 30)
else:
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 6
Instances
Project Name: home-assistant/home-assistant
Commit Name: c32f47aea657b887c12560a92d691c6fd7f6a311
Time: 2016-10-23
Author: me@robbiet.us
File Name: homeassistant/components/notify/ios.py
Class Name: iOSNotificationService
Method Name: send_message
Project Name: home-assistant/home-assistant
Commit Name: 626763a7c344235073d6831e54502f74fcd4365c
Time: 2016-10-23
Author: me@robbiet.us
File Name: homeassistant/components/notify/ios.py
Class Name: iOSNotificationService
Method Name: send_message
Project Name: deepchem/deepchem
Commit Name: 38e2076694fd069be6be5d0be428b28e7eddc99e
Time: 2019-07-30
Author: vsomnath@student.ethz.ch
File Name: deepchem/molnet/load_function/thermosol_datasets.py
Class Name:
Method Name: load_thermosol
Project Name: deepchem/deepchem
Commit Name: 38e2076694fd069be6be5d0be428b28e7eddc99e
Time: 2019-07-30
Author: vsomnath@student.ethz.ch
File Name: deepchem/molnet/load_function/hppb_datasets.py
Class Name:
Method Name: load_hppb