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
d4341238
Commit
d4341238
authored
Jul 19, 2017
by
Helperhaps
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add group push example
parent
f5ff2331
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
7 deletions
+31
-7
__init__.py
examples/__init__.py
+4
-3
group_push_example.py
examples/group_push_example.py
+24
-0
report_example.py
examples/report_example.py
+1
-2
schedule_example.py
examples/schedule_example.py
+1
-2
core.py
jpush/core.py
+1
-0
No files found.
examples/__init__.py
View file @
d4341238
...
...
@@ -10,10 +10,12 @@ from . import device_example
from
.
import
push_example
from
.
import
report_example
from
.
import
schedule_example
from
.
import
group_push_example
__all__
=
[
device_example
,
push_example
,
report_example
,
schedule_example
]
\ No newline at end of file
schedule_example
,
group_push_example
]
examples/group_push_example.py
0 → 100644
View file @
d4341238
from
.
import
jpush
from
jpush
import
common
group_key
=
u'xxxxxx'
group_secret
=
u'xxxxxx'
group
=
jpush
.
GroupPush
(
group_key
,
group_secret
)
group
.
set_logging
(
"DEBUG"
)
def
all
():
push
=
group
.
create_push
()
push
.
audience
=
jpush
.
all_
push
.
notification
=
jpush
.
notification
(
alert
=
"!hello python jpush api"
)
push
.
platform
=
jpush
.
all_
try
:
response
=
push
.
send
()
except
common
.
Unauthorized
:
raise
common
.
Unauthorized
(
"Unauthorized"
)
except
common
.
APIConnectionException
:
raise
common
.
APIConnectionException
(
"conn"
)
except
common
.
JPushFailure
:
print
(
"JPushFailure"
)
except
:
print
(
"Exception"
)
examples/report_example.py
View file @
d4341238
...
...
@@ -11,4 +11,4 @@ def receivede():
report
.
get_received
(
"3289406737"
)
def
users
():
report
.
get_users
(
"DAY"
,
"2016-04-10"
,
"3"
)
\ No newline at end of file
report
.
get_users
(
"DAY"
,
"2016-04-10"
,
"3"
)
examples/schedule_example.py
View file @
d4341238
...
...
@@ -34,4 +34,4 @@ def put_schedule():
trigger
=
jpush
.
schedulepayload
.
trigger
(
"2016-05-17 12:00:00"
)
schedulepayload
=
jpush
.
schedulepayload
.
schedulepayload
(
"update a new name"
,
True
,
trigger
,
push
)
schedule
.
put_schedule
(
schedulepayload
,
"17349f00-0852-11e6-91b1-0021f653c902"
)
\ No newline at end of file
schedule
.
put_schedule
(
schedulepayload
,
"17349f00-0852-11e6-91b1-0021f653c902"
)
jpush/core.py
View file @
d4341238
...
...
@@ -16,6 +16,7 @@ logger = logging.getLogger('jpush')
class
JPush
(
object
):
def
__init__
(
self
,
key
,
secret
):
self
.
key
=
key
print
(
key
)
self
.
secret
=
secret
self
.
session
=
requests
.
Session
()
self
.
session
.
auth
=
(
key
,
secret
)
...
...
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