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
Hide 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
-----------
**Released 2015 Nov 9**
...
...
examples/device/example_aliasuser.py
View file @
b4e1c930
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
device
=
_jpush
.
create_device
()
alias
=
"alias1"
platform
=
"android,ios"
...
...
examples/device/example_clrtag.py
View file @
b4e1c930
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
device
=
_jpush
.
create_device
()
reg_id
=
'090c1f59f89'
entity
=
jpush
.
device_tag
(
""
)
...
...
examples/device/example_getdevice.py
View file @
b4e1c930
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
device
=
_jpush
.
create_device
()
reg_id
=
'090c1f59f89'
device
.
get_deviceinfo
(
reg_id
)
examples/device/example_rmalias.py
View file @
b4e1c930
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
device
=
_jpush
.
create_device
()
alias
=
"alias1"
platform
=
"android,ios"
...
...
examples/device/example_rmtag.py
View file @
b4e1c930
...
...
@@ -3,7 +3,7 @@
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
device
=
_jpush
.
create_device
()
tag
=
"ddd"
platform
=
"android,ios"
...
...
examples/device/example_tagexist.py
View file @
b4e1c930
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
device
=
_jpush
.
create_device
()
tag
=
"ddd"
registration_id
=
'090c1f59f89'
...
...
examples/device/example_taglist.py
View file @
b4e1c930
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
device
=
_jpush
.
create_device
()
device
.
get_taglist
()
examples/device/example_tagupduser.py
View file @
b4e1c930
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
device
=
_jpush
.
create_device
()
tag
=
"ddd"
entity
=
jpush
.
device_regid
(
jpush
.
add
(
"090c1f59f89"
))
...
...
examples/device/example_updevice.py
View file @
b4e1c930
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
device
=
_jpush
.
create_device
()
reg_id
=
'1507bfd3f7c466c355c'
entity
=
jpush
.
device_tag
(
jpush
.
add
(
"ddd"
,
"tageee"
))
...
...
examples/device/example_updevicemobile.py
View file @
b4e1c930
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
device
=
_jpush
.
create_device
()
reg_id
=
'1507bfd3f7c466c355c'
entity
=
jpush
.
device_mobile
(
"18588232140"
)
...
...
examples/push/example_audience.py
View file @
b4e1c930
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
push
=
_jpush
.
create_push
()
push
.
audience
=
jpush
.
audience
(
jpush
.
tag
(
"tag1"
,
"tag2"
),
...
...
examples/push/example_options.py
View file @
b4e1c930
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
_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, world!"
)
...
...
examples/push/example_platformmsg.py
View file @
b4e1c930
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
push
=
_jpush
.
create_push
()
push
.
audience
=
jpush
.
all_
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
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
push
=
_jpush
.
create_push
()
push
.
audience
=
jpush
.
all_
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
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
push
=
_jpush
.
create_push
()
push
.
audience
=
jpush
.
all_
push
.
notification
=
jpush
.
notification
(
alert
=
"a sms message from python jpush api"
)
...
...
examples/push/example_validate.py
View file @
b4e1c930
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
_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, world!"
)
...
...
examples/report/example_messages.py
View file @
b4e1c930
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
report
=
_jpush
.
create_report
();
report
.
get_messages
(
"3289406737"
)
\ No newline at end of file
examples/report/example_received.py
View file @
b4e1c930
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
report
=
_jpush
.
create_report
();
report
.
get_received
(
"3289406737"
)
\ No newline at end of file
examples/report/example_users.py
View file @
b4e1c930
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
report
=
_jpush
.
create_report
();
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
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
schedule
=
_jpush
.
create_schedule
()
schedule
.
delete_schedule
(
"e9c553d0-0850-11e6-b6d4-0021f652c102"
)
examples/schedule/example_get_schedule.py
View file @
b4e1c930
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
schedule
=
_jpush
.
create_schedule
()
schedule
.
get_schedule_by_id
(
"e9c553d0-0850-11e6-b6d4-0021f652c102"
)
examples/schedule/example_get_schedule_list.py
View file @
b4e1c930
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
schedule
=
_jpush
.
create_schedule
()
schedule
.
get_schedule_list
(
"1"
)
\ No newline at end of file
examples/schedule/example_post_schedule.py
View file @
b4e1c930
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
schedule
=
_jpush
.
create_schedule
()
push
=
_jpush
.
create_push
()
...
...
examples/schedule/example_put_schedule.py
View file @
b4e1c930
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
_jpush
.
set_logging
(
"DEBUG"
)
schedule
=
_jpush
.
create_schedule
()
push
=
_jpush
.
create_push
()
...
...
jpush/device/core.py
View file @
b4e1c930
...
...
@@ -24,7 +24,6 @@ class Device(object):
url
=
common
.
TAGLIST_URL
body
=
None
info
=
self
.
send
(
"GET"
,
url
,
body
)
print
(
info
)
return
info
def
get_deviceinfo
(
self
,
registration_id
):
...
...
@@ -33,7 +32,6 @@ class Device(object):
url
=
common
.
DEVICE_URL
+
registration_id
+
"/"
body
=
None
info
=
self
.
send
(
"GET"
,
url
,
body
)
print
(
info
)
return
info
def
set_deviceinfo
(
self
,
registration_id
,
entity
):
...
...
@@ -42,7 +40,6 @@ class Device(object):
url
=
common
.
DEVICE_URL
+
registration_id
+
"/"
body
=
json
.
dumps
(
entity
)
info
=
self
.
send
(
"POST"
,
url
,
body
)
print
(
url
),
(
body
),
(
info
)
return
info
def
set_devicemobile
(
self
,
registration_id
,
entity
):
...
...
@@ -51,7 +48,6 @@ class Device(object):
url
=
common
.
DEVICE_URL
+
registration_id
+
"/"
body
=
json
.
dumps
(
entity
)
info
=
self
.
send
(
"POST"
,
url
,
body
)
print
(
url
),
(
body
),
(
info
)
return
info
def
delete_tag
(
self
,
tag
,
platform
=
None
):
...
...
@@ -61,9 +57,7 @@ class Device(object):
body
=
None
if
platform
:
body
=
platform
print
(
url
),
(
body
)
info
=
self
.
send
(
"DELETE"
,
url
,
body
)
print
(
info
)
return
info
def
update_tagusers
(
self
,
tag
,
entity
):
...
...
@@ -71,9 +65,7 @@ class Device(object):
"""
url
=
common
.
TAG_URL
+
tag
+
"/"
body
=
json
.
dumps
(
entity
)
print
(
url
),
(
body
)
info
=
self
.
send
(
"POST"
,
url
,
body
)
print
(
info
)
return
info
def
check_taguserexist
(
self
,
tag
,
registration_id
):
...
...
@@ -81,9 +73,7 @@ class Device(object):
"""
url
=
common
.
TAG_URL
+
tag
+
"/registration_ids/"
+
registration_id
body
=
registration_id
print
(
url
),
(
registration_id
)
info
=
self
.
send
(
"GET"
,
url
,
body
)
print
(
info
)
return
info
def
delete_alias
(
self
,
alias
,
platform
=
None
):
...
...
@@ -93,9 +83,7 @@ class Device(object):
body
=
None
if
platform
:
body
=
platform
print
(
url
),
(
body
)
info
=
self
.
send
(
"DELETE"
,
url
,
body
)
print
(
info
)
return
info
def
get_aliasuser
(
self
,
alias
,
platform
=
None
):
...
...
@@ -105,9 +93,7 @@ class Device(object):
body
=
None
if
platform
:
body
=
platform
print
(
url
),
(
body
)
info
=
self
.
send
(
"GET"
,
url
,
body
)
print
(
info
)
return
info
...
...
jpush/push/core.py
View file @
b4e1c930
...
...
@@ -45,10 +45,7 @@ class Push(object):
"""
body
=
json
.
dumps
(
self
.
payload
)
response
=
self
.
_jpush
.
_request
(
'POST'
,
body
,
common
.
PUSH_URL
,
'application/json'
,
version
=
3
)
print
(
response
.
content
)
response
=
self
.
_jpush
.
_request
(
'POST'
,
body
,
common
.
PUSH_URL
,
'application/json'
,
version
=
3
)
return
PushResponse
(
response
)
def
send_validate
(
self
):
...
...
@@ -62,8 +59,6 @@ class Push(object):
"""
body
=
json
.
dumps
(
self
.
payload
)
response
=
self
.
_jpush
.
_request
(
'POST'
,
body
,
common
.
VALIDATE_PUSH_URL
,
'application/json'
,
version
=
3
)
print
(
response
.
content
)
return
PushResponse
(
response
)
...
...
jpush/report/core.py
View file @
b4e1c930
...
...
@@ -13,7 +13,6 @@ class Report(object):
def
send
(
self
,
method
,
url
,
body
,
content_type
=
None
,
version
=
3
):
"""Send the request
"""
response
=
self
.
_jpush
.
_request
(
method
,
body
,
url
,
content_type
,
version
=
3
)
return
ReportResponse
(
response
)
...
...
@@ -22,33 +21,23 @@ class Report(object):
url
=
common
.
RECEIVED_URL
+
msg_ids
body
=
None
received
=
self
.
send
(
"GET"
,
url
,
body
)
print
(
received
)
return
received
def
get_messages
(
self
,
msg_ids
):
url
=
common
.
MESSAGES_URL
+
msg_ids
body
=
None
messages
=
self
.
send
(
"GET"
,
url
,
body
)
print
(
messages
)
return
messages
def
get_users
(
self
,
time_unit
,
start
,
duration
):
url
=
common
.
USERS_URL
+
"time_unit="
+
time_unit
+
"&start="
+
start
+
"&duration="
+
duration
print
url
body
=
None
users
=
self
.
send
(
"GET"
,
url
,
body
)
print
(
users
)
return
users
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
status_code
=
None
...
...
jpush/schedule/core.py
View file @
b4e1c930
...
...
@@ -18,15 +18,12 @@ class Schedule(object):
url
=
common
.
BASE_SCHEDULEURL
body
=
json
.
dumps
(
schedulepayload
)
result
=
self
.
send
(
"POST"
,
url
,
body
)
print
(
result
)
return
result
def
get_schedule_by_id
(
self
,
schedule_id
):
url
=
common
.
BASE_SCHEDULEURL
+
schedule_id
print
url
body
=
None
result
=
self
.
send
(
"GET"
,
url
,
body
)
print
(
result
)
return
result
def
get_schedule_list
(
self
,
page_id
):
...
...
@@ -34,25 +31,20 @@ class Schedule(object):
url
=
common
.
BASE_LISTURL
+
page_id
else
:
url
=
common
.
BASE_LISTURL
print
url
body
=
None
result
=
self
.
send
(
"GET"
,
url
,
body
)
print
(
result
)
return
result
def
put_schedule
(
self
,
schedulepayload
,
schedule_id
):
url
=
common
.
BASE_SCHEDULEURL
+
schedule_id
body
=
json
.
dumps
(
schedulepayload
)
result
=
self
.
send
(
"PUT"
,
url
,
body
)
print
(
result
)
return
result
def
delete_schedule
(
self
,
schedule_id
):
url
=
common
.
BASE_SCHEDULEURL
+
schedule_id
print
url
body
=
None
result
=
self
.
send
(
"DELETE"
,
url
,
body
)
print
(
result
)
return
result
...
...
setup.py
View file @
b4e1c930
...
...
@@ -14,7 +14,7 @@ with open('jpush/__init__.py', 'rb') as f:
setup
(
name
=
'jpush'
,
version
=
version
,
version
=
'3.2.0'
,
description
=
'JPush
\'
s officially supported Python client library'
,
keywords
=
(
'JPush'
,
'JPush API'
,
'Android Push'
,
'iOS Push'
),
license
=
'MIT License'
,
...
...
tests/devices/test_devices.py
View file @
b4e1c930
import
unittest
from
jpush
import
device
import
jpush
as
jpush
from
conf
import
app_key
,
master_secret
from
jpush
import
device
from
jpush
import
common
import
jpush
as
jpush
_jpush
=
jpush
.
JPush
(
app_key
,
master_secret
)
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