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
ca179c93
Commit
ca179c93
authored
Jan 30, 2018
by
Helperhaps
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
format code
parent
689d0d08
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
34 deletions
+19
-34
core.py
jpush/device/core.py
+11
-20
core.py
jpush/report/core.py
+4
-7
core.py
jpush/schedule/core.py
+4
-7
No files found.
jpush/device/core.py
View file @
ca179c93
...
@@ -12,27 +12,25 @@ class Device(object):
...
@@ -12,27 +12,25 @@ class Device(object):
self
.
entity
=
None
self
.
entity
=
None
self
.
zone
=
zone
or
jpush
.
zone
self
.
zone
=
zone
or
jpush
.
zone
def
send
(
self
,
method
,
url
,
body
,
content_type
=
None
,
version
=
3
):
def
send
(
self
,
method
,
url
,
body
=
None
,
content_type
=
None
,
version
=
3
,
params
=
None
):
"""Send the request
"""Send the request
"""
"""
response
=
self
.
_jpush
.
_request
(
method
,
body
,
url
,
content_type
,
version
=
3
)
response
=
self
.
_jpush
.
_request
(
method
,
body
,
url
,
content_type
,
version
=
3
,
params
=
params
)
return
DeviceResponse
(
response
)
return
DeviceResponse
(
response
)
def
get_taglist
(
self
):
def
get_taglist
(
self
):
"""Get deviceinfo with registration id.
"""Get deviceinfo with registration id.
"""
"""
url
=
common
.
get_url
(
'tag'
,
self
.
zone
)
url
=
common
.
get_url
(
'tag'
,
self
.
zone
)
body
=
None
info
=
self
.
send
(
"GET"
,
url
)
info
=
self
.
send
(
"GET"
,
url
,
body
)
return
info
return
info
def
get_deviceinfo
(
self
,
registration_id
):
def
get_deviceinfo
(
self
,
registration_id
):
"""Get deviceinfo with registration id.
"""Get deviceinfo with registration id.
"""
"""
url
=
common
.
get_url
(
'device'
,
self
.
zone
)
+
registration_id
url
=
common
.
get_url
(
'device'
,
self
.
zone
)
+
registration_id
body
=
None
info
=
self
.
send
(
"GET"
,
url
)
info
=
self
.
send
(
"GET"
,
url
,
body
)
return
info
return
info
def
set_deviceinfo
(
self
,
registration_id
,
entity
):
def
set_deviceinfo
(
self
,
registration_id
,
entity
):
...
@@ -55,10 +53,8 @@ class Device(object):
...
@@ -55,10 +53,8 @@ class Device(object):
"""Delete registration id tag.
"""Delete registration id tag.
"""
"""
url
=
common
.
get_url
(
'tag'
,
self
.
zone
)
+
tag
url
=
common
.
get_url
(
'tag'
,
self
.
zone
)
+
tag
body
=
None
params
=
{
'platform'
:
platform
}
if
platform
else
None
if
platform
:
info
=
self
.
send
(
"DELETE"
,
url
,
params
=
params
)
body
=
platform
info
=
self
.
send
(
"DELETE"
,
url
,
body
)
return
info
return
info
def
update_tagusers
(
self
,
tag
,
entity
):
def
update_tagusers
(
self
,
tag
,
entity
):
...
@@ -73,28 +69,23 @@ class Device(object):
...
@@ -73,28 +69,23 @@ class Device(object):
"""Check registration id whether in tag.
"""Check registration id whether in tag.
"""
"""
url
=
common
.
get_url
(
'tag'
,
self
.
zone
)
+
tag
+
"/registration_ids/"
+
registration_id
url
=
common
.
get_url
(
'tag'
,
self
.
zone
)
+
tag
+
"/registration_ids/"
+
registration_id
body
=
registration_id
info
=
self
.
send
(
"GET"
,
url
)
info
=
self
.
send
(
"GET"
,
url
,
body
)
return
info
return
info
def
delete_alias
(
self
,
alias
,
platform
=
None
):
def
delete_alias
(
self
,
alias
,
platform
=
None
):
"""Delete appkey alias.
"""Delete appkey alias.
"""
"""
url
=
common
.
get_url
(
'alias'
,
self
.
zone
)
+
alias
url
=
common
.
get_url
(
'alias'
,
self
.
zone
)
+
alias
body
=
None
params
=
{
'platform'
:
platform
}
if
platform
else
None
if
platform
:
info
=
self
.
send
(
"DELETE"
,
url
,
params
=
params
)
body
=
platform
info
=
self
.
send
(
"DELETE"
,
url
,
body
)
return
info
return
info
def
get_aliasuser
(
self
,
alias
,
platform
=
None
):
def
get_aliasuser
(
self
,
alias
,
platform
=
None
):
"""Get appkey alias users.
"""Get appkey alias users.
"""
"""
url
=
common
.
get_url
(
'alias'
,
self
.
zone
)
+
alias
url
=
common
.
get_url
(
'alias'
,
self
.
zone
)
+
alias
body
=
None
params
=
{
'platform'
:
platform
}
if
platform
else
None
if
platform
:
info
=
self
.
send
(
"GET"
,
url
,
params
=
params
)
body
=
platform
info
=
self
.
send
(
"GET"
,
url
,
body
)
return
info
return
info
...
...
jpush/report/core.py
View file @
ca179c93
...
@@ -10,7 +10,7 @@ class Report(object):
...
@@ -10,7 +10,7 @@ class Report(object):
self
.
_jpush
=
jpush
self
.
_jpush
=
jpush
self
.
zone
=
zone
or
jpush
.
zone
self
.
zone
=
zone
or
jpush
.
zone
def
send
(
self
,
method
,
url
,
body
,
content_type
=
None
,
version
=
3
,
params
=
None
):
def
send
(
self
,
method
,
url
,
body
=
None
,
content_type
=
None
,
version
=
3
,
params
=
None
):
"""Send the request
"""Send the request
"""
"""
response
=
self
.
_jpush
.
_request
(
method
,
body
,
url
,
content_type
,
version
=
3
,
params
=
params
)
response
=
self
.
_jpush
.
_request
(
method
,
body
,
url
,
content_type
,
version
=
3
,
params
=
params
)
...
@@ -19,15 +19,13 @@ class Report(object):
...
@@ -19,15 +19,13 @@ class Report(object):
def
get_received
(
self
,
msg_ids
):
def
get_received
(
self
,
msg_ids
):
url
=
common
.
get_url
(
'report'
,
self
.
zone
)
+
'received'
url
=
common
.
get_url
(
'report'
,
self
.
zone
)
+
'received'
params
=
{
'msg_ids'
:
msg_ids
}
params
=
{
'msg_ids'
:
msg_ids
}
body
=
None
received
=
self
.
send
(
"GET"
,
url
,
params
=
params
)
received
=
self
.
send
(
"GET"
,
url
,
body
,
params
=
params
)
return
received
return
received
def
get_messages
(
self
,
msg_ids
):
def
get_messages
(
self
,
msg_ids
):
url
=
common
.
get_url
(
'report'
,
self
.
zone
)
+
'messages'
url
=
common
.
get_url
(
'report'
,
self
.
zone
)
+
'messages'
params
=
{
'msg_ids'
:
msg_ids
}
params
=
{
'msg_ids'
:
msg_ids
}
body
=
None
messages
=
self
.
send
(
"GET"
,
url
,
params
=
params
)
messages
=
self
.
send
(
"GET"
,
url
,
body
,
params
=
params
)
return
messages
return
messages
def
get_users
(
self
,
time_unit
,
start
,
duration
):
def
get_users
(
self
,
time_unit
,
start
,
duration
):
...
@@ -37,8 +35,7 @@ class Report(object):
...
@@ -37,8 +35,7 @@ class Report(object):
'start'
:
start
,
'start'
:
start
,
'duration'
:
duration
'duration'
:
duration
}
}
body
=
None
users
=
self
.
send
(
"GET"
,
url
,
params
=
params
)
users
=
self
.
send
(
"GET"
,
url
,
body
,
params
=
params
)
return
users
return
users
...
...
jpush/schedule/core.py
View file @
ca179c93
...
@@ -11,7 +11,7 @@ class Schedule(object):
...
@@ -11,7 +11,7 @@ class Schedule(object):
self
.
_jpush
=
jpush
self
.
_jpush
=
jpush
self
.
zone
=
zone
or
jpush
.
zone
self
.
zone
=
zone
or
jpush
.
zone
def
send
(
self
,
method
,
url
,
body
,
content_type
=
None
,
version
=
3
,
params
=
None
):
def
send
(
self
,
method
,
url
,
body
=
None
,
content_type
=
None
,
version
=
3
,
params
=
None
):
response
=
self
.
_jpush
.
_request
(
method
,
body
,
url
,
content_type
,
version
=
3
,
params
=
params
)
response
=
self
.
_jpush
.
_request
(
method
,
body
,
url
,
content_type
,
version
=
3
,
params
=
params
)
return
ScheduleResponse
(
response
)
return
ScheduleResponse
(
response
)
...
@@ -23,15 +23,13 @@ class Schedule(object):
...
@@ -23,15 +23,13 @@ class Schedule(object):
def
get_schedule_by_id
(
self
,
schedule_id
):
def
get_schedule_by_id
(
self
,
schedule_id
):
url
=
common
.
get_url
(
'schedule'
,
self
.
zone
)
+
schedule_id
url
=
common
.
get_url
(
'schedule'
,
self
.
zone
)
+
schedule_id
body
=
None
result
=
self
.
send
(
"GET"
,
url
)
result
=
self
.
send
(
"GET"
,
url
,
body
)
return
result
return
result
def
get_schedule_list
(
self
,
page
=
1
):
def
get_schedule_list
(
self
,
page
=
1
):
url
=
common
.
get_url
(
'schedule'
,
self
.
zone
)
url
=
common
.
get_url
(
'schedule'
,
self
.
zone
)
params
=
{
'page'
:
page
}
params
=
{
'page'
:
page
}
body
=
None
result
=
self
.
send
(
"GET"
,
url
,
params
=
params
)
result
=
self
.
send
(
"GET"
,
url
,
body
,
params
=
params
)
return
result
return
result
def
put_schedule
(
self
,
schedulepayload
,
schedule_id
):
def
put_schedule
(
self
,
schedulepayload
,
schedule_id
):
...
@@ -42,8 +40,7 @@ class Schedule(object):
...
@@ -42,8 +40,7 @@ class Schedule(object):
def
delete_schedule
(
self
,
schedule_id
):
def
delete_schedule
(
self
,
schedule_id
):
url
=
common
.
get_url
(
'schedule'
,
self
.
zone
)
+
schedule_id
url
=
common
.
get_url
(
'schedule'
,
self
.
zone
)
+
schedule_id
body
=
None
result
=
self
.
send
(
"DELETE"
,
url
)
result
=
self
.
send
(
"DELETE"
,
url
,
body
)
return
result
return
result
...
...
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