Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jpush-api-python-client
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
jpush-api-python-client
Commits
abae8226
Commit
abae8226
authored
Sep 28, 2014
by
hupantingxue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validate Push;
parent
31f7ebfb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
0 deletions
+26
-0
example_validate.py
examples/push/example_validate.py
+9
-0
common.py
jpush/common.py
+1
-0
core.py
jpush/push/core.py
+16
-0
No files found.
examples/push/example_validate.py
0 → 100644
View file @
abae8226
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
push
=
_jpush
.
create_push
()
push
.
audience
=
jpush
.
all_
push
.
notification
=
jpush
.
notification
(
alert
=
"Hello, world!"
)
push
.
platform
=
jpush
.
all_
push
.
send_validate
()
jpush/common.py
View file @
abae8226
...
...
@@ -4,6 +4,7 @@ import logging
BASE_URL
=
"https://api.jpush.cn/"
PUSH_URL
=
BASE_URL
+
'v3/push'
VALIDATE_PUSH_URL
=
BASE_URL
+
'v3/push/validate'
DEVICE_BASEURL
=
"https://device.jpush.cn/"
DEVICE_URL
=
DEVICE_BASEURL
+
"v3/devices/"
...
...
jpush/push/core.py
View file @
abae8226
...
...
@@ -48,6 +48,22 @@ class Push(object):
print
(
response
.
content
)
return
PushResponse
(
response
)
def
send_validate
(
self
):
"""Send the notification to validate.
:returns: :py:class:`PushResponse` object with ``push_ids`` and
other response data.
:raises JPushFailure: Request failed.
:raises Unauthorized: Authentication failed.
"""
body
=
json
.
dumps
(
self
.
payload
)
response
=
self
.
_jpush
.
_request
(
'POST'
,
body
,
common
.
VALIDATE_PUSH_URL
,
'application/json'
,
version
=
3
)
print
(
response
.
content
)
return
PushResponse
(
response
)
class
PushResponse
(
object
):
"""Response to a successful push notification send.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment