remote_server: Return the result dictionary on success.

This commit is contained in:
Tim Abbott
2019-01-31 16:02:48 -08:00
parent 6613f4c22c
commit 1bcd7dfbad

View File

@@ -15,7 +15,7 @@ class PushNotificationBouncerException(Exception):
def send_to_push_bouncer(method: str, def send_to_push_bouncer(method: str,
endpoint: str, endpoint: str,
post_data: Union[str, Dict[str, Any]], post_data: Union[str, Dict[str, Any]],
extra_headers: Optional[Dict[str, Any]]=None) -> None: extra_headers: Optional[Dict[str, Any]]=None) -> Dict[str, Any]:
"""While it does actually send the notice, this function has a lot of """While it does actually send the notice, this function has a lot of
code and comments around error handling for the push notifications code and comments around error handling for the push notifications
bouncer. There are several classes of failures, each with its own bouncer. There are several classes of failures, each with its own
@@ -76,6 +76,7 @@ def send_to_push_bouncer(method: str,
"Push notification bouncer returned unexpected status code %s" % (res.status_code,)) "Push notification bouncer returned unexpected status code %s" % (res.status_code,))
# If we don't throw an exception, it's a successful bounce! # If we don't throw an exception, it's a successful bounce!
return ujson.loads(res.content)
def send_json_to_push_bouncer(method: str, endpoint: str, post_data: Dict[str, Any]) -> None: def send_json_to_push_bouncer(method: str, endpoint: str, post_data: Dict[str, Any]) -> None:
send_to_push_bouncer( send_to_push_bouncer(