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
d9454aaf
Commit
d9454aaf
authored
Apr 29, 2016
by
fendouai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix format
parent
066e02d6
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
9 deletions
+14
-9
core.py
jpush/core.py
+2
-1
entity.py
jpush/device/entity.py
+3
-0
core.py
jpush/report/core.py
+2
-1
core.py
jpush/schedule/core.py
+5
-5
schedulepayload.py
jpush/schedule/schedulepayload.py
+2
-2
No files found.
jpush/core.py
View file @
d9454aaf
...
@@ -12,12 +12,13 @@ from .schedule import Schedule
...
@@ -12,12 +12,13 @@ from .schedule import Schedule
logger
=
logging
.
getLogger
(
'jpush'
)
logger
=
logging
.
getLogger
(
'jpush'
)
logging
.
basicConfig
(
level
=
logging
.
DEBUG
,
logging
.
basicConfig
(
level
=
logging
.
DEBUG
,
format
=
'
%(asctime)
s
%(filename)
s[line:
%(lineno)
d]
%(levelname)
s
%(message)
s'
,
format
=
'
%(asctime)
s
%(filename)
s[line:
%(lineno)
d]
%(levelname)
s
%(message)
s'
,
datefmt
=
'
%
a,
%
d
%
b
%
Y
%
H:
%
M:
%
S'
,
datefmt
=
'
%
a,
%
d
%
b
%
Y
%
H:
%
M:
%
S'
,
filename
=
'jpush.log'
,
filename
=
'jpush.log'
,
filemode
=
'w'
)
filemode
=
'w'
)
class
JPush
(
object
):
class
JPush
(
object
):
def
__init__
(
self
,
key
,
secret
):
def
__init__
(
self
,
key
,
secret
):
self
.
key
=
key
self
.
key
=
key
...
...
jpush/device/entity.py
View file @
d9454aaf
...
@@ -53,11 +53,13 @@ def device_tag(*types):
...
@@ -53,11 +53,13 @@ def device_tag(*types):
tag
[
"tags"
][
key
]
=
t
[
key
]
tag
[
"tags"
][
key
]
=
t
[
key
]
return
tag
return
tag
def
device_mobile
(
device_mobile
):
def
device_mobile
(
device_mobile
):
mobile
=
{}
mobile
=
{}
mobile
[
"mobile"
]
=
device_mobile
mobile
[
"mobile"
]
=
device_mobile
return
mobile
return
mobile
def
device_alias
(
*
types
):
def
device_alias
(
*
types
):
"""Get an alias object
"""Get an alias object
...
@@ -80,6 +82,7 @@ def device_alias(*types):
...
@@ -80,6 +82,7 @@ def device_alias(*types):
alias
[
"alias"
][
key
]
=
t
[
key
]
alias
[
"alias"
][
key
]
=
t
[
key
]
return
alias
return
alias
def
device_regid
(
*
types
):
def
device_regid
(
*
types
):
"""Get a registration_id object
"""Get a registration_id object
...
...
jpush/report/core.py
View file @
d9454aaf
...
@@ -5,6 +5,7 @@ from jpush import common
...
@@ -5,6 +5,7 @@ from jpush import common
logger
=
logging
.
getLogger
(
'jpush'
)
logger
=
logging
.
getLogger
(
'jpush'
)
class
Report
(
object
):
class
Report
(
object
):
"""JPush Report API V3"""
"""JPush Report API V3"""
def
__init__
(
self
,
jpush
):
def
__init__
(
self
,
jpush
):
...
@@ -25,7 +26,6 @@ class Report(object):
...
@@ -25,7 +26,6 @@ class Report(object):
print
(
received
)
print
(
received
)
return
received
return
received
def
get_messages
(
self
,
msg_ids
):
def
get_messages
(
self
,
msg_ids
):
url
=
common
.
MESSAGES_URL
+
msg_ids
url
=
common
.
MESSAGES_URL
+
msg_ids
body
=
None
body
=
None
...
@@ -41,6 +41,7 @@ class Report(object):
...
@@ -41,6 +41,7 @@ class Report(object):
print
(
users
)
print
(
users
)
return
users
return
users
class
ReportResponse
(
object
):
class
ReportResponse
(
object
):
"""Response to a successful device request send.
"""Response to a successful device request send.
...
...
jpush/schedule/core.py
View file @
d9454aaf
...
@@ -13,14 +13,14 @@ class Schedule(object):
...
@@ -13,14 +13,14 @@ class Schedule(object):
response
=
self
.
_jpush
.
_request
(
method
,
body
,
url
,
content_type
,
version
=
3
)
response
=
self
.
_jpush
.
_request
(
method
,
body
,
url
,
content_type
,
version
=
3
)
return
ScheduleResponse
(
response
)
return
ScheduleResponse
(
response
)
def
post_schedule
(
self
,
schedulepayload
):
def
post_schedule
(
self
,
schedulepayload
):
url
=
common
.
BASE_SCHEDULEURL
url
=
common
.
BASE_SCHEDULEURL
body
=
json
.
dumps
(
schedulepayload
)
body
=
json
.
dumps
(
schedulepayload
)
result
=
self
.
send
(
"POST"
,
url
,
body
)
result
=
self
.
send
(
"POST"
,
url
,
body
)
print
(
result
)
print
(
result
)
return
result
return
result
def
get_schedule_by_id
(
self
,
schedule_id
):
def
get_schedule_by_id
(
self
,
schedule_id
):
url
=
common
.
BASE_SCHEDULEURL
+
schedule_id
url
=
common
.
BASE_SCHEDULEURL
+
schedule_id
print
url
print
url
body
=
None
body
=
None
...
@@ -28,7 +28,7 @@ class Schedule(object):
...
@@ -28,7 +28,7 @@ class Schedule(object):
print
(
result
)
print
(
result
)
return
result
return
result
def
get_schedule_list
(
self
,
page_id
):
def
get_schedule_list
(
self
,
page_id
):
if
page_id
is
not
None
:
if
page_id
is
not
None
:
url
=
common
.
BASE_LISTURL
+
page_id
url
=
common
.
BASE_LISTURL
+
page_id
else
:
else
:
...
@@ -39,8 +39,7 @@ class Schedule(object):
...
@@ -39,8 +39,7 @@ class Schedule(object):
print
(
result
)
print
(
result
)
return
result
return
result
def
put_schedule
(
self
,
schedulepayload
,
schedule_id
):
def
put_schedule
(
self
,
schedulepayload
,
schedule_id
):
url
=
common
.
BASE_SCHEDULEURL
+
schedule_id
url
=
common
.
BASE_SCHEDULEURL
+
schedule_id
body
=
json
.
dumps
(
schedulepayload
)
body
=
json
.
dumps
(
schedulepayload
)
result
=
self
.
send
(
"PUT"
,
url
,
body
)
result
=
self
.
send
(
"PUT"
,
url
,
body
)
...
@@ -55,6 +54,7 @@ class Schedule(object):
...
@@ -55,6 +54,7 @@ class Schedule(object):
print
(
result
)
print
(
result
)
return
result
return
result
class
ScheduleResponse
(
object
):
class
ScheduleResponse
(
object
):
"""Response to a successful device request send.
"""Response to a successful device request send.
...
...
jpush/schedule/schedulepayload.py
View file @
d9454aaf
...
@@ -11,11 +11,11 @@ def schedulepayload(name=None, enabled=None, trigger=None, push=None):
...
@@ -11,11 +11,11 @@ def schedulepayload(name=None, enabled=None, trigger=None, push=None):
if
push
is
not
None
:
if
push
is
not
None
:
schedulepayload
[
'push'
]
=
push
schedulepayload
[
'push'
]
=
push
if
not
schedulepayload
:
if
not
schedulepayload
:
raise
ValueError
(
"schedulepayload may not be empty"
)
raise
ValueError
(
"schedule
payload may not be empty"
)
return
schedulepayload
return
schedulepayload
def
trigger
(
time
,
start
=
None
,
end
=
None
,
time_unit
=
None
,
frequency
=
None
,
point
=
None
):
def
trigger
(
time
,
start
=
None
,
end
=
None
,
time_unit
=
None
,
frequency
=
None
,
point
=
None
):
if
(
start
==
None
and
end
==
None
and
time_unit
==
None
and
frequency
==
None
):
if
(
start
==
None
and
end
==
None
and
time_unit
==
None
and
frequency
==
None
):
trigger
=
{}
trigger
=
{}
single
=
{}
single
=
{}
...
...
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