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
b4e1c930
Commit
b4e1c930
authored
May 17, 2016
by
fendouai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove print,add logging debug
parent
df5d7020
Show whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
38 additions
and
66 deletions
+38
-66
CHANGES.txt
CHANGES.txt
+5
-0
example_aliasuser.py
examples/device/example_aliasuser.py
+1
-1
example_clrtag.py
examples/device/example_clrtag.py
+1
-1
example_getdevice.py
examples/device/example_getdevice.py
+1
-1
example_rmalias.py
examples/device/example_rmalias.py
+1
-1
example_rmtag.py
examples/device/example_rmtag.py
+1
-1
example_tagexist.py
examples/device/example_tagexist.py
+1
-1
example_taglist.py
examples/device/example_taglist.py
+1
-1
example_tagupduser.py
examples/device/example_tagupduser.py
+1
-1
example_updevice.py
examples/device/example_updevice.py
+1
-1
example_updevicemobile.py
examples/device/example_updevicemobile.py
+1
-1
example_audience.py
examples/push/example_audience.py
+1
-1
example_options.py
examples/push/example_options.py
+1
-1
example_platformmsg.py
examples/push/example_platformmsg.py
+1
-1
example_silent.py
examples/push/example_silent.py
+1
-1
example_sms.py
examples/push/example_sms.py
+1
-1
example_validate.py
examples/push/example_validate.py
+1
-1
example_messages.py
examples/report/example_messages.py
+2
-1
example_received.py
examples/report/example_received.py
+2
-1
example_users.py
examples/report/example_users.py
+2
-1
example_delete_schedule.py
examples/schedule/example_delete_schedule.py
+1
-1
example_get_schedule.py
examples/schedule/example_get_schedule.py
+1
-1
example_get_schedule_list.py
examples/schedule/example_get_schedule_list.py
+2
-1
example_post_schedule.py
examples/schedule/example_post_schedule.py
+1
-1
example_put_schedule.py
examples/schedule/example_put_schedule.py
+1
-1
core.py
jpush/device/core.py
+0
-14
core.py
jpush/push/core.py
+1
-6
core.py
jpush/report/core.py
+0
-11
core.py
jpush/schedule/core.py
+0
-8
setup.py
setup.py
+1
-1
test_devices.py
tests/devices/test_devices.py
+3
-2
No files found.
CHANGES.txt
View file @
b4e1c930
Version 3.2.0
-----------
**Released 2015 Nov 9**
Add push sms message api;
Version 3.1.0
Version 3.1.0
-----------
-----------
**Released 2015 Nov 9**
**Released 2015 Nov 9**
...
...
examples/device/example_aliasuser.py
View file @
b4e1c930
import
jpush
as
jpush
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
device
=
_jpush
.
create_device
()
device
=
_jpush
.
create_device
()
alias
=
"alias1"
alias
=
"alias1"
platform
=
"android,ios"
platform
=
"android,ios"
...
...
examples/device/example_clrtag.py
View file @
b4e1c930
import
jpush
as
jpush
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
device
=
_jpush
.
create_device
()
device
=
_jpush
.
create_device
()
reg_id
=
'090c1f59f89'
reg_id
=
'090c1f59f89'
entity
=
jpush
.
device_tag
(
""
)
entity
=
jpush
.
device_tag
(
""
)
...
...
examples/device/example_getdevice.py
View file @
b4e1c930
import
jpush
as
jpush
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
device
=
_jpush
.
create_device
()
device
=
_jpush
.
create_device
()
reg_id
=
'090c1f59f89'
reg_id
=
'090c1f59f89'
device
.
get_deviceinfo
(
reg_id
)
device
.
get_deviceinfo
(
reg_id
)
examples/device/example_rmalias.py
View file @
b4e1c930
import
jpush
as
jpush
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
device
=
_jpush
.
create_device
()
device
=
_jpush
.
create_device
()
alias
=
"alias1"
alias
=
"alias1"
platform
=
"android,ios"
platform
=
"android,ios"
...
...
examples/device/example_rmtag.py
View file @
b4e1c930
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
import
jpush
as
jpush
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
device
=
_jpush
.
create_device
()
device
=
_jpush
.
create_device
()
tag
=
"ddd"
tag
=
"ddd"
platform
=
"android,ios"
platform
=
"android,ios"
...
...
examples/device/example_tagexist.py
View file @
b4e1c930
import
jpush
as
jpush
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
device
=
_jpush
.
create_device
()
device
=
_jpush
.
create_device
()
tag
=
"ddd"
tag
=
"ddd"
registration_id
=
'090c1f59f89'
registration_id
=
'090c1f59f89'
...
...
examples/device/example_taglist.py
View file @
b4e1c930
import
jpush
as
jpush
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
device
=
_jpush
.
create_device
()
device
=
_jpush
.
create_device
()
device
.
get_taglist
()
device
.
get_taglist
()
examples/device/example_tagupduser.py
View file @
b4e1c930
import
jpush
as
jpush
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
device
=
_jpush
.
create_device
()
device
=
_jpush
.
create_device
()
tag
=
"ddd"
tag
=
"ddd"
entity
=
jpush
.
device_regid
(
jpush
.
add
(
"090c1f59f89"
))
entity
=
jpush
.
device_regid
(
jpush
.
add
(
"090c1f59f89"
))
...
...
examples/device/example_updevice.py
View file @
b4e1c930
import
jpush
as
jpush
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
device
=
_jpush
.
create_device
()
device
=
_jpush
.
create_device
()
reg_id
=
'1507bfd3f7c466c355c'
reg_id
=
'1507bfd3f7c466c355c'
entity
=
jpush
.
device_tag
(
jpush
.
add
(
"ddd"
,
"tageee"
))
entity
=
jpush
.
device_tag
(
jpush
.
add
(
"ddd"
,
"tageee"
))
...
...
examples/device/example_updevicemobile.py
View file @
b4e1c930
import
jpush
as
jpush
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
device
=
_jpush
.
create_device
()
device
=
_jpush
.
create_device
()
reg_id
=
'1507bfd3f7c466c355c'
reg_id
=
'1507bfd3f7c466c355c'
entity
=
jpush
.
device_mobile
(
"18588232140"
)
entity
=
jpush
.
device_mobile
(
"18588232140"
)
...
...
examples/push/example_audience.py
View file @
b4e1c930
import
jpush
as
jpush
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
push
=
_jpush
.
create_push
()
push
=
_jpush
.
create_push
()
push
.
audience
=
jpush
.
audience
(
push
.
audience
=
jpush
.
audience
(
jpush
.
tag
(
"tag1"
,
"tag2"
),
jpush
.
tag
(
"tag1"
,
"tag2"
),
...
...
examples/push/example_options.py
View file @
b4e1c930
import
jpush
as
jpush
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
push
=
_jpush
.
create_push
()
push
=
_jpush
.
create_push
()
push
.
audience
=
jpush
.
all_
push
.
audience
=
jpush
.
all_
push
.
notification
=
jpush
.
notification
(
alert
=
"Hello, world!"
)
push
.
notification
=
jpush
.
notification
(
alert
=
"Hello, world!"
)
...
...
examples/push/example_platformmsg.py
View file @
b4e1c930
import
jpush
as
jpush
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
push
=
_jpush
.
create_push
()
push
=
_jpush
.
create_push
()
push
.
audience
=
jpush
.
all_
push
.
audience
=
jpush
.
all_
ios_msg
=
jpush
.
ios
(
alert
=
"Hello, IOS JPush!"
,
badge
=
"+1"
,
sound
=
"a.caf"
,
extras
=
{
'k1'
:
'v1'
})
ios_msg
=
jpush
.
ios
(
alert
=
"Hello, IOS JPush!"
,
badge
=
"+1"
,
sound
=
"a.caf"
,
extras
=
{
'k1'
:
'v1'
})
...
...
examples/push/example_silent.py
View file @
b4e1c930
import
jpush
as
jpush
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
push
=
_jpush
.
create_push
()
push
=
_jpush
.
create_push
()
push
.
audience
=
jpush
.
all_
push
.
audience
=
jpush
.
all_
ios_msg
=
jpush
.
ios
(
alert
=
"Hello, IOS JPush!"
,
badge
=
"+1"
,
extras
=
{
'k1'
:
'v1'
},
sound_disable
=
True
)
ios_msg
=
jpush
.
ios
(
alert
=
"Hello, IOS JPush!"
,
badge
=
"+1"
,
extras
=
{
'k1'
:
'v1'
},
sound_disable
=
True
)
...
...
examples/push/example_sms.py
View file @
b4e1c930
import
jpush
as
jpush
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
push
=
_jpush
.
create_push
()
push
=
_jpush
.
create_push
()
push
.
audience
=
jpush
.
all_
push
.
audience
=
jpush
.
all_
push
.
notification
=
jpush
.
notification
(
alert
=
"a sms message from python jpush api"
)
push
.
notification
=
jpush
.
notification
(
alert
=
"a sms message from python jpush api"
)
...
...
examples/push/example_validate.py
View file @
b4e1c930
import
jpush
as
jpush
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
push
=
_jpush
.
create_push
()
push
=
_jpush
.
create_push
()
push
.
audience
=
jpush
.
all_
push
.
audience
=
jpush
.
all_
push
.
notification
=
jpush
.
notification
(
alert
=
"Hello, world!"
)
push
.
notification
=
jpush
.
notification
(
alert
=
"Hello, world!"
)
...
...
examples/report/example_messages.py
View file @
b4e1c930
import
jpush
as
jpush
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
report
=
_jpush
.
create_report
();
report
=
_jpush
.
create_report
();
report
.
get_messages
(
"3289406737"
)
report
.
get_messages
(
"3289406737"
)
\ No newline at end of file
examples/report/example_received.py
View file @
b4e1c930
import
jpush
as
jpush
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
report
=
_jpush
.
create_report
();
report
=
_jpush
.
create_report
();
report
.
get_received
(
"3289406737"
)
report
.
get_received
(
"3289406737"
)
\ No newline at end of file
examples/report/example_users.py
View file @
b4e1c930
import
jpush
as
jpush
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
report
=
_jpush
.
create_report
();
report
=
_jpush
.
create_report
();
report
.
get_users
(
"DAY"
,
"2016-04-10"
,
"3"
)
report
.
get_users
(
"DAY"
,
"2016-04-10"
,
"3"
)
\ No newline at end of file
examples/schedule/example_delete_schedule.py
View file @
b4e1c930
import
jpush
as
jpush
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
schedule
=
_jpush
.
create_schedule
()
schedule
=
_jpush
.
create_schedule
()
schedule
.
delete_schedule
(
"e9c553d0-0850-11e6-b6d4-0021f652c102"
)
schedule
.
delete_schedule
(
"e9c553d0-0850-11e6-b6d4-0021f652c102"
)
examples/schedule/example_get_schedule.py
View file @
b4e1c930
import
jpush
as
jpush
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
schedule
=
_jpush
.
create_schedule
()
schedule
=
_jpush
.
create_schedule
()
schedule
.
get_schedule_by_id
(
"e9c553d0-0850-11e6-b6d4-0021f652c102"
)
schedule
.
get_schedule_by_id
(
"e9c553d0-0850-11e6-b6d4-0021f652c102"
)
examples/schedule/example_get_schedule_list.py
View file @
b4e1c930
import
jpush
as
jpush
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
schedule
=
_jpush
.
create_schedule
()
schedule
=
_jpush
.
create_schedule
()
schedule
.
get_schedule_list
(
"1"
)
schedule
.
get_schedule_list
(
"1"
)
\ No newline at end of file
examples/schedule/example_post_schedule.py
View file @
b4e1c930
import
jpush
as
jpush
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
schedule
=
_jpush
.
create_schedule
()
schedule
=
_jpush
.
create_schedule
()
push
=
_jpush
.
create_push
()
push
=
_jpush
.
create_push
()
...
...
examples/schedule/example_put_schedule.py
View file @
b4e1c930
import
jpush
as
jpush
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
schedule
=
_jpush
.
create_schedule
()
schedule
=
_jpush
.
create_schedule
()
push
=
_jpush
.
create_push
()
push
=
_jpush
.
create_push
()
...
...
jpush/device/core.py
View file @
b4e1c930
...
@@ -24,7 +24,6 @@ class Device(object):
...
@@ -24,7 +24,6 @@ class Device(object):
url
=
common
.
TAGLIST_URL
url
=
common
.
TAGLIST_URL
body
=
None
body
=
None
info
=
self
.
send
(
"GET"
,
url
,
body
)
info
=
self
.
send
(
"GET"
,
url
,
body
)
print
(
info
)
return
info
return
info
def
get_deviceinfo
(
self
,
registration_id
):
def
get_deviceinfo
(
self
,
registration_id
):
...
@@ -33,7 +32,6 @@ class Device(object):
...
@@ -33,7 +32,6 @@ class Device(object):
url
=
common
.
DEVICE_URL
+
registration_id
+
"/"
url
=
common
.
DEVICE_URL
+
registration_id
+
"/"
body
=
None
body
=
None
info
=
self
.
send
(
"GET"
,
url
,
body
)
info
=
self
.
send
(
"GET"
,
url
,
body
)
print
(
info
)
return
info
return
info
def
set_deviceinfo
(
self
,
registration_id
,
entity
):
def
set_deviceinfo
(
self
,
registration_id
,
entity
):
...
@@ -42,7 +40,6 @@ class Device(object):
...
@@ -42,7 +40,6 @@ class Device(object):
url
=
common
.
DEVICE_URL
+
registration_id
+
"/"
url
=
common
.
DEVICE_URL
+
registration_id
+
"/"
body
=
json
.
dumps
(
entity
)
body
=
json
.
dumps
(
entity
)
info
=
self
.
send
(
"POST"
,
url
,
body
)
info
=
self
.
send
(
"POST"
,
url
,
body
)
print
(
url
),
(
body
),
(
info
)
return
info
return
info
def
set_devicemobile
(
self
,
registration_id
,
entity
):
def
set_devicemobile
(
self
,
registration_id
,
entity
):
...
@@ -51,7 +48,6 @@ class Device(object):
...
@@ -51,7 +48,6 @@ class Device(object):
url
=
common
.
DEVICE_URL
+
registration_id
+
"/"
url
=
common
.
DEVICE_URL
+
registration_id
+
"/"
body
=
json
.
dumps
(
entity
)
body
=
json
.
dumps
(
entity
)
info
=
self
.
send
(
"POST"
,
url
,
body
)
info
=
self
.
send
(
"POST"
,
url
,
body
)
print
(
url
),
(
body
),
(
info
)
return
info
return
info
def
delete_tag
(
self
,
tag
,
platform
=
None
):
def
delete_tag
(
self
,
tag
,
platform
=
None
):
...
@@ -61,9 +57,7 @@ class Device(object):
...
@@ -61,9 +57,7 @@ class Device(object):
body
=
None
body
=
None
if
platform
:
if
platform
:
body
=
platform
body
=
platform
print
(
url
),
(
body
)
info
=
self
.
send
(
"DELETE"
,
url
,
body
)
info
=
self
.
send
(
"DELETE"
,
url
,
body
)
print
(
info
)
return
info
return
info
def
update_tagusers
(
self
,
tag
,
entity
):
def
update_tagusers
(
self
,
tag
,
entity
):
...
@@ -71,9 +65,7 @@ class Device(object):
...
@@ -71,9 +65,7 @@ class Device(object):
"""
"""
url
=
common
.
TAG_URL
+
tag
+
"/"
url
=
common
.
TAG_URL
+
tag
+
"/"
body
=
json
.
dumps
(
entity
)
body
=
json
.
dumps
(
entity
)
print
(
url
),
(
body
)
info
=
self
.
send
(
"POST"
,
url
,
body
)
info
=
self
.
send
(
"POST"
,
url
,
body
)
print
(
info
)
return
info
return
info
def
check_taguserexist
(
self
,
tag
,
registration_id
):
def
check_taguserexist
(
self
,
tag
,
registration_id
):
...
@@ -81,9 +73,7 @@ class Device(object):
...
@@ -81,9 +73,7 @@ class Device(object):
"""
"""
url
=
common
.
TAG_URL
+
tag
+
"/registration_ids/"
+
registration_id
url
=
common
.
TAG_URL
+
tag
+
"/registration_ids/"
+
registration_id
body
=
registration_id
body
=
registration_id
print
(
url
),
(
registration_id
)
info
=
self
.
send
(
"GET"
,
url
,
body
)
info
=
self
.
send
(
"GET"
,
url
,
body
)
print
(
info
)
return
info
return
info
def
delete_alias
(
self
,
alias
,
platform
=
None
):
def
delete_alias
(
self
,
alias
,
platform
=
None
):
...
@@ -93,9 +83,7 @@ class Device(object):
...
@@ -93,9 +83,7 @@ class Device(object):
body
=
None
body
=
None
if
platform
:
if
platform
:
body
=
platform
body
=
platform
print
(
url
),
(
body
)
info
=
self
.
send
(
"DELETE"
,
url
,
body
)
info
=
self
.
send
(
"DELETE"
,
url
,
body
)
print
(
info
)
return
info
return
info
def
get_aliasuser
(
self
,
alias
,
platform
=
None
):
def
get_aliasuser
(
self
,
alias
,
platform
=
None
):
...
@@ -105,9 +93,7 @@ class Device(object):
...
@@ -105,9 +93,7 @@ class Device(object):
body
=
None
body
=
None
if
platform
:
if
platform
:
body
=
platform
body
=
platform
print
(
url
),
(
body
)
info
=
self
.
send
(
"GET"
,
url
,
body
)
info
=
self
.
send
(
"GET"
,
url
,
body
)
print
(
info
)
return
info
return
info
...
...
jpush/push/core.py
View file @
b4e1c930
...
@@ -45,10 +45,7 @@ class Push(object):
...
@@ -45,10 +45,7 @@ class Push(object):
"""
"""
body
=
json
.
dumps
(
self
.
payload
)
body
=
json
.
dumps
(
self
.
payload
)
response
=
self
.
_jpush
.
_request
(
'POST'
,
body
,
response
=
self
.
_jpush
.
_request
(
'POST'
,
body
,
common
.
PUSH_URL
,
'application/json'
,
version
=
3
)
common
.
PUSH_URL
,
'application/json'
,
version
=
3
)
print
(
response
.
content
)
return
PushResponse
(
response
)
return
PushResponse
(
response
)
def
send_validate
(
self
):
def
send_validate
(
self
):
...
@@ -62,8 +59,6 @@ class Push(object):
...
@@ -62,8 +59,6 @@ class Push(object):
"""
"""
body
=
json
.
dumps
(
self
.
payload
)
body
=
json
.
dumps
(
self
.
payload
)
response
=
self
.
_jpush
.
_request
(
'POST'
,
body
,
common
.
VALIDATE_PUSH_URL
,
'application/json'
,
version
=
3
)
response
=
self
.
_jpush
.
_request
(
'POST'
,
body
,
common
.
VALIDATE_PUSH_URL
,
'application/json'
,
version
=
3
)
print
(
response
.
content
)
return
PushResponse
(
response
)
return
PushResponse
(
response
)
...
...
jpush/report/core.py
View file @
b4e1c930
...
@@ -13,7 +13,6 @@ class Report(object):
...
@@ -13,7 +13,6 @@ class Report(object):
def
send
(
self
,
method
,
url
,
body
,
content_type
=
None
,
version
=
3
):
def
send
(
self
,
method
,
url
,
body
,
content_type
=
None
,
version
=
3
):
"""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
)
return
ReportResponse
(
response
)
return
ReportResponse
(
response
)
...
@@ -22,33 +21,23 @@ class Report(object):
...
@@ -22,33 +21,23 @@ class Report(object):
url
=
common
.
RECEIVED_URL
+
msg_ids
url
=
common
.
RECEIVED_URL
+
msg_ids
body
=
None
body
=
None
received
=
self
.
send
(
"GET"
,
url
,
body
)
received
=
self
.
send
(
"GET"
,
url
,
body
)
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
messages
=
self
.
send
(
"GET"
,
url
,
body
)
messages
=
self
.
send
(
"GET"
,
url
,
body
)
print
(
messages
)
return
messages
return
messages
def
get_users
(
self
,
time_unit
,
start
,
duration
):
def
get_users
(
self
,
time_unit
,
start
,
duration
):
url
=
common
.
USERS_URL
+
"time_unit="
+
time_unit
+
"&start="
+
start
+
"&duration="
+
duration
url
=
common
.
USERS_URL
+
"time_unit="
+
time_unit
+
"&start="
+
start
+
"&duration="
+
duration
print
url
body
=
None
body
=
None
users
=
self
.
send
(
"GET"
,
url
,
body
)
users
=
self
.
send
(
"GET"
,
url
,
body
)
print
(
users
)
return
users
return
users
class
ReportResponse
(
object
):
class
ReportResponse
(
object
):
"""Response to a successful device request send.
Right now this is a fairly simple wrapper around the json payload response,
but making it an object gives us some flexibility to add functionality
later.
"""
payload
=
None
payload
=
None
status_code
=
None
status_code
=
None
...
...
jpush/schedule/core.py
View file @
b4e1c930
...
@@ -18,15 +18,12 @@ class Schedule(object):
...
@@ -18,15 +18,12 @@ class Schedule(object):
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
)
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
body
=
None
body
=
None
result
=
self
.
send
(
"GET"
,
url
,
body
)
result
=
self
.
send
(
"GET"
,
url
,
body
)
print
(
result
)
return
result
return
result
def
get_schedule_list
(
self
,
page_id
):
def
get_schedule_list
(
self
,
page_id
):
...
@@ -34,25 +31,20 @@ class Schedule(object):
...
@@ -34,25 +31,20 @@ class Schedule(object):
url
=
common
.
BASE_LISTURL
+
page_id
url
=
common
.
BASE_LISTURL
+
page_id
else
:
else
:
url
=
common
.
BASE_LISTURL
url
=
common
.
BASE_LISTURL
print
url
body
=
None
body
=
None
result
=
self
.
send
(
"GET"
,
url
,
body
)
result
=
self
.
send
(
"GET"
,
url
,
body
)
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
)
print
(
result
)
return
result
return
result
def
delete_schedule
(
self
,
schedule_id
):
def
delete_schedule
(
self
,
schedule_id
):
url
=
common
.
BASE_SCHEDULEURL
+
schedule_id
url
=
common
.
BASE_SCHEDULEURL
+
schedule_id
print
url
body
=
None
body
=
None
result
=
self
.
send
(
"DELETE"
,
url
,
body
)
result
=
self
.
send
(
"DELETE"
,
url
,
body
)
print
(
result
)
return
result
return
result
...
...
setup.py
View file @
b4e1c930
...
@@ -14,7 +14,7 @@ with open('jpush/__init__.py', 'rb') as f:
...
@@ -14,7 +14,7 @@ with open('jpush/__init__.py', 'rb') as f:
setup
(
setup
(
name
=
'jpush'
,
name
=
'jpush'
,
version
=
version
,
version
=
'3.2.0'
,
description
=
'JPush
\'
s officially supported Python client library'
,
description
=
'JPush
\'
s officially supported Python client library'
,
keywords
=
(
'JPush'
,
'JPush API'
,
'Android Push'
,
'iOS Push'
),
keywords
=
(
'JPush'
,
'JPush API'
,
'Android Push'
,
'iOS Push'
),
license
=
'MIT License'
,
license
=
'MIT License'
,
...
...
tests/devices/test_devices.py
View file @
b4e1c930
import
unittest
import
unittest
from
jpush
import
device
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
conf
import
app_key
,
master_secret
from
jpush
import
device
from
jpush
import
common
from
jpush
import
common
import
jpush
as
jpush
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
device
=
_jpush
.
create_device
()
device
=
_jpush
.
create_device
()
...
...
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