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
d5315fc9
Commit
d5315fc9
authored
Jul 18, 2017
by
Helperhaps
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete useless files in examples fold & and GroupPush
parent
598c479e
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
16 additions
and
22 deletions
+16
-22
__init__.py
examples/__init__.py
+0
-7
conf.py
examples/device_examples/conf.py
+0
-3
conf.py
examples/push_examples/conf.py
+0
-3
conf.py
examples/report_examples/conf.py
+0
-3
conf.py
examples/schedule_examples/conf.py
+0
-3
__init__.py
jpush/__init__.py
+2
-1
common.py
jpush/common.py
+1
-0
core.py
jpush/core.py
+9
-0
core.py
jpush/push/core.py
+4
-2
No files found.
examples/__init__.py
deleted
100644 → 0
View file @
598c479e
"""Python package for using the JPush API"""
from
.conf
import
app_key
,
master_secret
__all__
=
[
app_key
,
master_secret
,
]
examples/device_examples/conf.py
deleted
100644 → 0
View file @
598c479e
# please put your app_key and master_secret here
app_key
=
u'6be9204c30b9473e87bad4dc'
master_secret
=
u'9349ad7c90292a603c512e92'
examples/push_examples/conf.py
deleted
100644 → 0
View file @
598c479e
# please put your app_key and master_secret here
app_key
=
u'6be9204c30b9473e87bad4dc'
master_secret
=
u'a19bef7870c55d7e51f4c4f0'
examples/report_examples/conf.py
deleted
100644 → 0
View file @
598c479e
# please put your app_key and master_secret here
app_key
=
u'6be9204c30b9473e87bad4dc'
master_secret
=
u'9349ad7c90292a603c512e92'
examples/schedule_examples/conf.py
deleted
100644 → 0
View file @
598c479e
# please put your app_key and master_secret here
app_key
=
u'6be9204c30b9473e87bad4dc'
master_secret
=
u'9349ad7c90292a603c512e92'
jpush/__init__.py
View file @
d5315fc9
"""Python package for using the JPush API"""
from
.core
import
JPush
from
.core
import
JPush
,
GroupPush
from
.common
import
JPushFailure
,
Unauthorized
from
.push
import
(
...
...
@@ -43,6 +43,7 @@ from .schedule import (
__all__
=
[
JPush
,
GroupPush
,
JPushFailure
,
Unauthorized
,
all_
,
...
...
jpush/common.py
View file @
d5315fc9
...
...
@@ -5,6 +5,7 @@ import requests
BASE_URL
=
"https://api.jpush.cn/"
PUSH_URL
=
BASE_URL
+
'v3/push'
VALIDATE_PUSH_URL
=
BASE_URL
+
'v3/push/validate'
GROUP_PUSH_URL
=
BASE_URL
+
'v3/grouppush'
DEVICE_BASEURL
=
"https://device.jpush.cn/"
DEVICE_URL
=
DEVICE_BASEURL
+
"v3/devices/"
...
...
jpush/core.py
View file @
d5315fc9
...
...
@@ -89,3 +89,12 @@ class JPush(object):
def
create_schedule
(
self
):
"""Create a Schedule."""
return
Schedule
(
self
)
class
GroupPush
(
JPush
):
def
__init__
(
self
,
key
,
secret
):
super
()
.
__init__
(
'group-'
+
key
,
secret
)
def
create_push
(
self
):
"""Create a Group Push notification."""
return
Push
(
self
,
url
=
common
.
GROUP_PUSH_URL
)
jpush/push/core.py
View file @
d5315fc9
...
...
@@ -8,7 +8,7 @@ logger = logging.getLogger('jpush')
class
Push
(
object
):
"""A push notification. Set audience, message, etc, and send."""
def
__init__
(
self
,
jpush
):
def
__init__
(
self
,
jpush
,
url
=
common
.
PUSH_URL
):
self
.
_jpush
=
jpush
self
.
audience
=
None
self
.
notification
=
None
...
...
@@ -17,6 +17,7 @@ class Push(object):
self
.
options
=
None
self
.
message
=
None
self
.
smsmessage
=
None
self
.
url
=
url
@property
def
payload
(
self
):
...
...
@@ -48,7 +49,8 @@ class Push(object):
"""
body
=
json
.
dumps
(
self
.
payload
)
response
=
self
.
_jpush
.
_request
(
'POST'
,
body
,
common
.
PUSH_URL
,
'application/json'
,
version
=
3
)
url
=
self
.
url
response
=
self
.
_jpush
.
_request
(
'POST'
,
body
,
url
,
'application/json'
,
version
=
3
)
return
PushResponse
(
response
)
def
send_validate
(
self
):
...
...
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