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
812a8b4b
Commit
812a8b4b
authored
Jul 10, 2017
by
Helperhaps
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update new api
parent
14e03be7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
1 deletion
+25
-1
__init__.py
jpush/push/__init__.py
+6
-0
audience.py
jpush/push/audience.py
+10
-0
core.py
jpush/push/core.py
+3
-0
payload.py
jpush/push/payload.py
+6
-1
No files found.
jpush/push/__init__.py
View file @
812a8b4b
...
...
@@ -6,6 +6,8 @@ from .audience import (
tag_not
,
alias
,
registration_id
,
segment
,
abtest
)
from
.payload
import
(
...
...
@@ -13,6 +15,7 @@ from .payload import (
ios
,
winphone
,
platform
,
cid
,
notification
,
message
,
audience
,
...
...
@@ -36,9 +39,12 @@ __all__ = [
tag_not
,
alias
,
registration_id
,
segment
,
abtest
,
notification
,
message
,
platform
,
cid
,
audience
,
options
,
smsmessage
,
...
...
jpush/push/audience.py
View file @
812a8b4b
...
...
@@ -26,3 +26,13 @@ def registration_id(*reg_ids):
"""Select a (list of) registration_id(s)."""
vregistration_id
=
[
t
for
t
in
reg_ids
]
return
{
"registration_id"
:
vregistration_id
}
def
segment
(
*
segments
):
"""Select a (list of) segment(s)."""
vsegment
=
[
t
for
t
in
segments
]
return
{
"segment"
:
vsegment
}
def
abtest
(
*
abtests
):
"""Select a (list of) abtest(s)."""
vabtest
=
[
t
for
t
in
reg_ids
]
return
{
"abtest"
:
vabtest
}
jpush/push/core.py
View file @
812a8b4b
...
...
@@ -13,6 +13,7 @@ class Push(object):
self
.
audience
=
None
self
.
notification
=
None
self
.
platform
=
None
self
.
cid
=
None
self
.
options
=
None
self
.
message
=
None
self
.
smsmessage
=
None
...
...
@@ -25,6 +26,8 @@ class Push(object):
}
if
(
self
.
notification
is
None
)
and
(
self
.
message
is
None
):
raise
ValueError
(
"Notification and message cannot be both empty"
)
if
self
.
cid
is
not
None
:
data
[
'cid'
]
=
self
.
cid
if
self
.
notification
is
not
None
:
data
[
'notification'
]
=
self
.
notification
if
self
.
smsmessage
is
not
None
:
...
...
jpush/push/payload.py
View file @
812a8b4b
...
...
@@ -166,6 +166,11 @@ def smsmessage(content,delay_time):
return
payload
def
cid
(
cid
):
payload
=
{}
payload
[
"cid"
]
=
cid
return
payload
def
platform
(
*
types
):
"""Create a platform specifier.
...
...
@@ -200,7 +205,7 @@ def audience(*types):
audience
=
{}
for
t
in
types
:
for
key
in
t
:
if
key
not
in
(
'tag'
,
'tag_and'
,
'tag_not'
,
'alias'
,
'registration_id'
):
if
key
not
in
(
'tag'
,
'tag_and'
,
'tag_not'
,
'alias'
,
'registration_id'
,
'segment'
,
'abtest'
):
raise
ValueError
(
"Invalid audience '
%
s'"
%
t
)
audience
[
key
]
=
t
[
key
]
return
audience
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