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
53c93d2d
Commit
53c93d2d
authored
Dec 28, 2016
by
fendouai
Committed by
GitHub
Dec 28, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into fix_python2_unicode
parents
9631af9e
4fb7f5d9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
4 deletions
+26
-4
conf.py
examples/push_examples/conf.py
+1
-1
example_alias.py
examples/push_examples/example_alias.py
+18
-0
example_audience.py
examples/push_examples/example_audience.py
+3
-0
payload.py
jpush/push/payload.py
+4
-3
No files found.
examples/push_examples/conf.py
View file @
53c93d2d
# please put your app_key and master_secret here
# please put your app_key and master_secret here
app_key
=
u'6be9204c30b9473e87bad4dc'
app_key
=
u'6be9204c30b9473e87bad4dc'
master_secret
=
u'
9349ad7c90292a603c512e92
'
master_secret
=
u'
a564b268ba23631a8a34e687
'
examples/push_examples/example_alias.py
0 → 100644
View file @
53c93d2d
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
push
=
_jpush
.
create_push
()
alias
=
[
"alias1"
,
"alias2"
]
alias1
=
{
"alias"
:
alias
}
print
alias1
push
.
audience
=
jpush
.
audience
(
jpush
.
tag
(
"tag1"
,
"tag2"
),
alias1
)
push
.
notification
=
jpush
.
notification
(
alert
=
"Hello world with audience!"
)
push
.
platform
=
jpush
.
all_
print
(
push
.
payload
)
push
.
send
()
\ No newline at end of file
examples/push_examples/example_audience.py
View file @
53c93d2d
...
@@ -3,10 +3,13 @@ from conf import app_key, master_secret
...
@@ -3,10 +3,13 @@ from conf import app_key, master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
_jpush
.
set_logging
(
"DEBUG"
)
push
=
_jpush
.
create_push
()
push
=
_jpush
.
create_push
()
push
.
audience
=
jpush
.
audience
(
push
.
audience
=
jpush
.
audience
(
jpush
.
tag
(
"tag1"
,
"tag2"
),
jpush
.
tag
(
"tag1"
,
"tag2"
),
jpush
.
alias
(
"alias1"
,
"alias2"
)
jpush
.
alias
(
"alias1"
,
"alias2"
)
)
)
push
.
notification
=
jpush
.
notification
(
alert
=
"Hello world with audience!"
)
push
.
notification
=
jpush
.
notification
(
alert
=
"Hello world with audience!"
)
push
.
platform
=
jpush
.
all_
push
.
platform
=
jpush
.
all_
print
(
push
.
payload
)
print
(
push
.
payload
)
...
...
jpush/push/payload.py
View file @
53c93d2d
...
@@ -56,7 +56,7 @@ def ios(alert=None, badge=None, sound=None, content_available=False,
...
@@ -56,7 +56,7 @@ def ios(alert=None, badge=None, sound=None, content_available=False,
"""
"""
payload
=
{}
payload
=
{}
if
alert
is
not
None
:
if
alert
is
not
None
:
if
not
(
isinstance
(
alert
,
string_types
)
or
isinstance
(
alert
,
dict
)):
if
not
isinstance
(
alert
,
(
str
,
dict
)):
raise
ValueError
(
"iOS alert must be a string or dictionary"
)
raise
ValueError
(
"iOS alert must be a string or dictionary"
)
payload
[
'alert'
]
=
alert
payload
[
'alert'
]
=
alert
if
badge
is
not
None
:
if
badge
is
not
None
:
...
@@ -79,8 +79,9 @@ def ios(alert=None, badge=None, sound=None, content_available=False,
...
@@ -79,8 +79,9 @@ def ios(alert=None, badge=None, sound=None, content_available=False,
def
android
(
alert
,
title
=
None
,
builder_id
=
None
,
extras
=
None
):
def
android
(
alert
,
title
=
None
,
builder_id
=
None
,
extras
=
None
):
"""Android specific platform override payload.
"""Android specific platform override payload.
All keyword arguments are optional.
:keyword alert: String alert text.If you set alert to a empty string,then the payload
will not display on notification bar.
more info:https://docs.jiguang.cn/jpush/server/push/rest_api_v3_push/#notification
:keyword alert: String alert text.
:keyword alert: String alert text.
:keyword title: String
:keyword title: String
:keyword builder_id: Integer
:keyword builder_id: Integer
...
...
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