Skip to content

Commit dd9e766

Browse files
authored
adds push validate endpoint (#177)
1 parent 576b309 commit dd9e766

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

urbanairship/core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def __init__(self, location=None):
2626
self.device_token_url = self.base_url + "device_tokens/"
2727
self.apid_url = self.base_url + "apids/"
2828
self.push_url = self.base_url + "push/"
29+
self.validate_url = self.push_url + "validate/"
2930
self.schedules_url = self.base_url + "schedules/"
3031
self.tags_url = self.base_url + "tags/"
3132
self.segments_url = self.base_url + "segments/"

urbanairship/push/core.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@ def device_types(self, types):
5050
)
5151
self._device_types = types
5252

53+
def validate(self):
54+
"""
55+
Test push payload against the validate endpoint. No sends will result from this
56+
method being called. This method is otherwise identical to the `send` method.
57+
"""
58+
59+
response = self._airship._request(
60+
method="POST",
61+
body=json.dumps(self.payload),
62+
url=self._airship.urls.get("validate_url"),
63+
content_type="application/json",
64+
version=3,
65+
)
66+
67+
return PushResponse(response)
68+
5369
def send(self):
5470
"""Send the notification.
5571

0 commit comments

Comments
 (0)