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
644fe185
Commit
644fe185
authored
Jan 30, 2018
by
Helperhaps
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add zone examples
parent
ca179c93
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
1 deletion
+42
-1
__init__.py
examples/__init__.py
+3
-1
zone_example.py
examples/zone_example.py
+39
-0
No files found.
examples/__init__.py
View file @
644fe185
...
...
@@ -12,6 +12,7 @@ from . import report_example
from
.
import
schedule_example
from
.
import
group_push_example
from
.
import
admin_example
from
.
import
zone_example
__all__
=
[
device_example
,
...
...
@@ -19,5 +20,6 @@ __all__ = [
report_example
,
schedule_example
,
group_push_example
,
admin_example
admin_example
,
zone_example
,
]
examples/zone_example.py
0 → 100644
View file @
644fe185
from
.
import
jpush
,
app_key
,
master_secret
def
default
():
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
push
=
_jpush
.
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"
)
def
bj
():
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
,
zone
=
'bj'
)
_jpush
.
set_logging
(
"DEBUG"
)
push
=
_jpush
.
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"
)
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