From f5ff23317d0e30ba98864bf2052eb7c457ceef8c Mon Sep 17 00:00:00 2001 From: Helperhaps Date: Tue, 18 Jul 2017 16:41:49 +0000 Subject: [PATCH] refactor examples --- examples/__init__.py | 19 +++ examples/conf.py | 2 +- examples/device_example.py | 54 +++++++++ examples/device_examples/example_aliasuser.py | 8 -- examples/device_examples/example_clrtag.py | 8 -- examples/device_examples/example_getdevice.py | 7 -- examples/device_examples/example_rmalias.py | 8 -- examples/device_examples/example_rmtag.py | 10 -- examples/device_examples/example_tagexist.py | 8 -- examples/device_examples/example_taglist.py | 6 - .../device_examples/example_tagupduser.py | 8 -- examples/device_examples/example_updevice.py | 10 -- .../device_examples/example_updevicemobile.py | 8 -- examples/push_example.py | 109 ++++++++++++++++++ examples/push_examples/example_alias.py | 17 --- examples/push_examples/example_all.py | 23 ---- examples/push_examples/example_audience.py | 16 --- .../push_examples/example_notification.py | 19 --- examples/push_examples/example_options.py | 10 -- examples/push_examples/example_platformmsg.py | 12 -- examples/push_examples/example_silent.py | 11 -- examples/push_examples/example_sms.py | 11 -- examples/push_examples/example_validate.py | 9 -- examples/report_example.py | 14 +++ examples/report_examples/example_messages.py | 6 - examples/report_examples/example_received.py | 6 - examples/report_examples/example_users.py | 6 - examples/schedule_example.py | 37 ++++++ .../example_delete_schedule.py | 6 - .../schedule_examples/example_get_schedule.py | 6 - .../example_get_schedule_list.py | 6 - .../example_post_schedule.py | 17 --- .../schedule_examples/example_put_schedule.py | 15 --- 33 files changed, 234 insertions(+), 278 deletions(-) create mode 100644 examples/__init__.py create mode 100644 examples/device_example.py delete mode 100644 examples/device_examples/example_aliasuser.py delete mode 100644 examples/device_examples/example_clrtag.py delete mode 100644 examples/device_examples/example_getdevice.py delete mode 100644 examples/device_examples/example_rmalias.py delete mode 100644 examples/device_examples/example_rmtag.py delete mode 100644 examples/device_examples/example_tagexist.py delete mode 100644 examples/device_examples/example_taglist.py delete mode 100644 examples/device_examples/example_tagupduser.py delete mode 100644 examples/device_examples/example_updevice.py delete mode 100644 examples/device_examples/example_updevicemobile.py create mode 100644 examples/push_example.py delete mode 100644 examples/push_examples/example_alias.py delete mode 100644 examples/push_examples/example_all.py delete mode 100644 examples/push_examples/example_audience.py delete mode 100644 examples/push_examples/example_notification.py delete mode 100644 examples/push_examples/example_options.py delete mode 100644 examples/push_examples/example_platformmsg.py delete mode 100644 examples/push_examples/example_silent.py delete mode 100644 examples/push_examples/example_sms.py delete mode 100644 examples/push_examples/example_validate.py create mode 100644 examples/report_example.py delete mode 100644 examples/report_examples/example_messages.py delete mode 100644 examples/report_examples/example_received.py delete mode 100644 examples/report_examples/example_users.py create mode 100644 examples/schedule_example.py delete mode 100644 examples/schedule_examples/example_delete_schedule.py delete mode 100644 examples/schedule_examples/example_get_schedule.py delete mode 100644 examples/schedule_examples/example_get_schedule_list.py delete mode 100644 examples/schedule_examples/example_post_schedule.py delete mode 100644 examples/schedule_examples/example_put_schedule.py diff --git a/examples/__init__.py b/examples/__init__.py new file mode 100644 index 0000000..46ef33c --- /dev/null +++ b/examples/__init__.py @@ -0,0 +1,19 @@ +import os +import sys +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + +import jpush + +from .conf import app_key, master_secret + +from . import device_example +from . import push_example +from . import report_example +from . import schedule_example + +__all__ = [ + device_example, + push_example, + report_example, + schedule_example +] \ No newline at end of file diff --git a/examples/conf.py b/examples/conf.py index 5b8764c..76aa676 100644 --- a/examples/conf.py +++ b/examples/conf.py @@ -1,3 +1,3 @@ # please put your app_key and master_secret here app_key = u'6be9204c30b9473e87bad4dc' -master_secret = u'9349ad7c90292a603c512e92' +master_secret = u'cae22120eed6835e486399a7' diff --git a/examples/device_example.py b/examples/device_example.py new file mode 100644 index 0000000..c62d5e3 --- /dev/null +++ b/examples/device_example.py @@ -0,0 +1,54 @@ +from . import jpush, app_key, master_secret + +_jpush = jpush.JPush(app_key, master_secret) +_jpush.set_logging("DEBUG") +device = _jpush.create_device() + +def alias_user(): + alias = "alias1" + platform = "android,ios" + device.get_aliasuser(alias, platform) + +def ctrl_tag(): + reg_id = '090c1f59f89' + entity = jpush.device_tag("") + device.set_deviceinfo(reg_id, entity) + +def get_device(): + reg_id = '090c1f59f89' + device.get_deviceinfo(reg_id) + +def delete_alias(): + alias = "alias1" + platform = "android,ios" + device.delete_alias(alias, platform) + +def delete_tag(): + tag = "ddd" + platform = "android,ios" + device.delete_tag(tag, platform) + +def check_tag(): + tag = "ddd" + registration_id = '090c1f59f89' + device.check_taguserexist(tag, registration_id) + +def tag_list(): + device.get_taglist() + +def tag_update_user(): + tag = "ddd" + entity = jpush.device_regid(jpush.add("090c1f59f89")) + device.update_tagusers(tag, entity) + +def update_device(): + reg_id = '1507bfd3f7c466c355c' + entity = jpush.device_tag(jpush.add("ddd", "tageee")) + result=device.set_devicemobile(reg_id, entity) + print (result.status_code) + print (result.payload) + +def update_device_mobile(): + reg_id = '1507bfd3f7c466c355c' + entity = jpush.device_mobile("18588232140") + device.set_devicemobile(reg_id, entity) diff --git a/examples/device_examples/example_aliasuser.py b/examples/device_examples/example_aliasuser.py deleted file mode 100644 index bc75584..0000000 --- a/examples/device_examples/example_aliasuser.py +++ /dev/null @@ -1,8 +0,0 @@ -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" -device.get_aliasuser(alias, platform) diff --git a/examples/device_examples/example_clrtag.py b/examples/device_examples/example_clrtag.py deleted file mode 100644 index 400047f..0000000 --- a/examples/device_examples/example_clrtag.py +++ /dev/null @@ -1,8 +0,0 @@ -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("") -device.set_deviceinfo(reg_id, entity) diff --git a/examples/device_examples/example_getdevice.py b/examples/device_examples/example_getdevice.py deleted file mode 100644 index d9afb2f..0000000 --- a/examples/device_examples/example_getdevice.py +++ /dev/null @@ -1,7 +0,0 @@ -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) diff --git a/examples/device_examples/example_rmalias.py b/examples/device_examples/example_rmalias.py deleted file mode 100644 index cd9e07c..0000000 --- a/examples/device_examples/example_rmalias.py +++ /dev/null @@ -1,8 +0,0 @@ -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" -device.delete_alias(alias, platform) diff --git a/examples/device_examples/example_rmtag.py b/examples/device_examples/example_rmtag.py deleted file mode 100644 index 6fa659f..0000000 --- a/examples/device_examples/example_rmtag.py +++ /dev/null @@ -1,10 +0,0 @@ -#-*- encoding:utf-8 -*- - -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" -device.delete_tag(tag, platform) diff --git a/examples/device_examples/example_tagexist.py b/examples/device_examples/example_tagexist.py deleted file mode 100644 index 22a73dc..0000000 --- a/examples/device_examples/example_tagexist.py +++ /dev/null @@ -1,8 +0,0 @@ -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' -device.check_taguserexist(tag, registration_id) diff --git a/examples/device_examples/example_taglist.py b/examples/device_examples/example_taglist.py deleted file mode 100644 index 5f771be..0000000 --- a/examples/device_examples/example_taglist.py +++ /dev/null @@ -1,6 +0,0 @@ -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() diff --git a/examples/device_examples/example_tagupduser.py b/examples/device_examples/example_tagupduser.py deleted file mode 100644 index 624bb64..0000000 --- a/examples/device_examples/example_tagupduser.py +++ /dev/null @@ -1,8 +0,0 @@ -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")) -device.update_tagusers(tag, entity) diff --git a/examples/device_examples/example_updevice.py b/examples/device_examples/example_updevice.py deleted file mode 100644 index b08f3de..0000000 --- a/examples/device_examples/example_updevice.py +++ /dev/null @@ -1,10 +0,0 @@ -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")) -result=device.set_devicemobile(reg_id, entity) -print (result.status_code) -print (result.payload) \ No newline at end of file diff --git a/examples/device_examples/example_updevicemobile.py b/examples/device_examples/example_updevicemobile.py deleted file mode 100644 index f24b027..0000000 --- a/examples/device_examples/example_updevicemobile.py +++ /dev/null @@ -1,8 +0,0 @@ -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") -device.set_devicemobile(reg_id, entity) diff --git a/examples/push_example.py b/examples/push_example.py new file mode 100644 index 0000000..0e5f03d --- /dev/null +++ b/examples/push_example.py @@ -0,0 +1,109 @@ +from . import jpush, app_key, master_secret + +_jpush = jpush.JPush(app_key, master_secret) +_jpush.set_logging("DEBUG") + +def alias(): + push = _jpush.create_push() + alias=["alias1", "alias2"] + alias1={"alias": alias} + print(alias1) + push.audience = jpush.audience( + jpush.tag("tag1", "tag2"), + alias1 + ) + + push.notification = jpush.notification(alert="Hello world with audience!") + push.platform = jpush.all_ + print (push.payload) + push.send() + +def all(): + push = _jpush.create_push() + push.audience = jpush.all_ + push.notification = jpush.notification(alert="!hello python jpush api") + push.platform = jpush.all_ + try: + response=push.send() + except common.Unauthorized: + raise common.Unauthorized("Unauthorized") + except common.APIConnectionException: + raise common.APIConnectionException("conn") + except common.JPushFailure: + print ("JPushFailure") + except: + print ("Exception") + +def audience(): + push = _jpush.create_push() + + push.audience = jpush.audience( + jpush.tag("tag1", "tag2"), + jpush.alias("alias1", "alias2") + ) + + + push.notification = jpush.notification(alert="Hello world with audience!") + push.platform = jpush.all_ + print (push.payload) + push.send() + + +def notification(): + push = _jpush.create_push() + + push.audience = jpush.all_ + push.platform = jpush.all_ + + ios = jpush.ios(alert="Hello, IOS JPush!", sound="a.caf", extras={'k1':'v1'}) + android = jpush.android(alert="Hello, Android msg", priority=1, style=1, alert_type=1,big_text='jjjjjjjjjj', extras={'k1':'v1'}) + + push.notification = jpush.notification(alert="Hello, JPush!", android=android, ios=ios) + + # pprint (push.payload) + result = push.send() + +def options(): + push = _jpush.create_push() + push.audience = jpush.all_ + push.notification = jpush.notification(alert="Hello, world!") + push.platform = jpush.all_ + push.options = {"time_to_live":86400, "sendno":12345,"apns_production":True} + push.send() + +def platfrom_msg(): + push = _jpush.create_push() + push.audience = jpush.all_ + ios_msg = jpush.ios(alert="Hello, IOS JPush!", badge="+1", sound="a.caf", extras={'k1':'v1'}) + android_msg = jpush.android(alert="Hello, android msg") + push.notification = jpush.notification(alert="Hello, JPush!", android=android_msg, ios=ios_msg) + push.message=jpush.message("content",extras={'k2':'v2','k3':'v3'}) + push.platform = jpush.all_ + push.send() + + +def silent(): + push = _jpush.create_push() + push.audience = jpush.all_ + ios_msg = jpush.ios(alert="Hello, IOS JPush!", badge="+1", extras={'k1':'v1'}, sound_disable=True) + android_msg = jpush.android(alert="Hello, android msg") + push.notification = jpush.notification(alert="Hello, JPush!", android=android_msg, ios=ios_msg) + push.platform = jpush.all_ + push.send() + + +def sms(): + push = _jpush.create_push() + push.audience = jpush.all_ + push.notification = jpush.notification(alert="a sms message from python jpush api") + push.platform = jpush.all_ + push.smsmessage=jpush.smsmessage("a sms message from python jpush api",0) + print (push.payload) + push.send() + +def validate(): + push = _jpush.create_push() + push.audience = jpush.all_ + push.notification = jpush.notification(alert="Hello, world!") + push.platform = jpush.all_ + push.send_validate() diff --git a/examples/push_examples/example_alias.py b/examples/push_examples/example_alias.py deleted file mode 100644 index 52e5e9f..0000000 --- a/examples/push_examples/example_alias.py +++ /dev/null @@ -1,17 +0,0 @@ -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() -alias=["alias1", "alias2"] -alias1={"alias": alias} -print alias1 -push.audience = jpush.audience( - jpush.tag("tag1", "tag2"), - alias1 -) - -push.notification = jpush.notification(alert="Hello world with audience!") -push.platform = jpush.all_ -print (push.payload) -push.send() \ No newline at end of file diff --git a/examples/push_examples/example_all.py b/examples/push_examples/example_all.py deleted file mode 100644 index 5697020..0000000 --- a/examples/push_examples/example_all.py +++ /dev/null @@ -1,23 +0,0 @@ -import jpush as jpush -from conf import app_key, master_secret -from jpush import common - -_jpush = jpush.JPush(app_key, master_secret) - -push = _jpush.create_push() - -# the default logging level is WARNING,if you set the logging level to "DEBUG",the it will show the debug logging -_jpush.set_logging("DEBUG") -push.audience = jpush.all_ -push.notification = jpush.notification(alert="!hello python jpush api") -push.platform = jpush.all_ -try: - response=push.send() -except common.Unauthorized: - raise common.Unauthorized("Unauthorized") -except common.APIConnectionException: - raise common.APIConnectionException("conn") -except common.JPushFailure: - print ("JPushFailure") -except: - print ("Exception") diff --git a/examples/push_examples/example_audience.py b/examples/push_examples/example_audience.py deleted file mode 100644 index c4fe3e0..0000000 --- a/examples/push_examples/example_audience.py +++ /dev/null @@ -1,16 +0,0 @@ -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"), - jpush.alias("alias1", "alias2") - ) - - -push.notification = jpush.notification(alert="Hello world with audience!") -push.platform = jpush.all_ -print (push.payload) -push.send() diff --git a/examples/push_examples/example_notification.py b/examples/push_examples/example_notification.py deleted file mode 100644 index 9ef19f4..0000000 --- a/examples/push_examples/example_notification.py +++ /dev/null @@ -1,19 +0,0 @@ -import jpush as jpush -from conf import app_key, master_secret -# from pprint import pprint - -_jpush = jpush.JPush(app_key, master_secret) -_jpush.set_logging("DEBUG") -push = _jpush.create_push() - -push.audience = jpush.all_ -push.platform = jpush.all_ - -ios = jpush.ios(alert="Hello, IOS JPush!", sound="a.caf", extras={'k1':'v1'}) -android = jpush.android(alert="Hello, Android msg", priority=1, style=1, alert_type=1,big_text='jjjjjjjjjj', extras={'k1':'v1'}) - -push.notification = jpush.notification(alert="Hello, JPush!", android=android, ios=ios) - -# pprint (push.payload) -result = push.send() - diff --git a/examples/push_examples/example_options.py b/examples/push_examples/example_options.py deleted file mode 100644 index d2ec472..0000000 --- a/examples/push_examples/example_options.py +++ /dev/null @@ -1,10 +0,0 @@ -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!") -push.platform = jpush.all_ -push.options = {"time_to_live":86400, "sendno":12345,"apns_production":True} -push.send() diff --git a/examples/push_examples/example_platformmsg.py b/examples/push_examples/example_platformmsg.py deleted file mode 100644 index 6266075..0000000 --- a/examples/push_examples/example_platformmsg.py +++ /dev/null @@ -1,12 +0,0 @@ -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'}) -android_msg = jpush.android(alert="Hello, android msg") -push.notification = jpush.notification(alert="Hello, JPush!", android=android_msg, ios=ios_msg) -push.message=jpush.message("content",extras={'k2':'v2','k3':'v3'}) -push.platform = jpush.all_ -push.send() diff --git a/examples/push_examples/example_silent.py b/examples/push_examples/example_silent.py deleted file mode 100644 index 470b887..0000000 --- a/examples/push_examples/example_silent.py +++ /dev/null @@ -1,11 +0,0 @@ -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) -android_msg = jpush.android(alert="Hello, android msg") -push.notification = jpush.notification(alert="Hello, JPush!", android=android_msg, ios=ios_msg) -push.platform = jpush.all_ -push.send() diff --git a/examples/push_examples/example_sms.py b/examples/push_examples/example_sms.py deleted file mode 100644 index de4da70..0000000 --- a/examples/push_examples/example_sms.py +++ /dev/null @@ -1,11 +0,0 @@ -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") -push.platform = jpush.all_ -push.smsmessage=jpush.smsmessage("a sms message from python jpush api",0) -print (push.payload) -push.send() diff --git a/examples/push_examples/example_validate.py b/examples/push_examples/example_validate.py deleted file mode 100644 index 5d16130..0000000 --- a/examples/push_examples/example_validate.py +++ /dev/null @@ -1,9 +0,0 @@ -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!") -push.platform = jpush.all_ -push.send_validate() diff --git a/examples/report_example.py b/examples/report_example.py new file mode 100644 index 0000000..fbab71d --- /dev/null +++ b/examples/report_example.py @@ -0,0 +1,14 @@ +from . import jpush, app_key, master_secret + +_jpush = jpush.JPush(app_key, master_secret) +_jpush.set_logging("DEBUG") +report=_jpush.create_report() + +def messages(): + report.get_messages("3289406737") + +def receivede(): + report.get_received("3289406737") + +def users(): + report.get_users("DAY","2016-04-10","3") \ No newline at end of file diff --git a/examples/report_examples/example_messages.py b/examples/report_examples/example_messages.py deleted file mode 100644 index 94d3039..0000000 --- a/examples/report_examples/example_messages.py +++ /dev/null @@ -1,6 +0,0 @@ -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 diff --git a/examples/report_examples/example_received.py b/examples/report_examples/example_received.py deleted file mode 100644 index 7131d5b..0000000 --- a/examples/report_examples/example_received.py +++ /dev/null @@ -1,6 +0,0 @@ -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 diff --git a/examples/report_examples/example_users.py b/examples/report_examples/example_users.py deleted file mode 100644 index 0a4ae79..0000000 --- a/examples/report_examples/example_users.py +++ /dev/null @@ -1,6 +0,0 @@ -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 diff --git a/examples/schedule_example.py b/examples/schedule_example.py new file mode 100644 index 0000000..4feb20c --- /dev/null +++ b/examples/schedule_example.py @@ -0,0 +1,37 @@ +from . import jpush, app_key, master_secret + +_jpush = jpush.JPush(app_key, master_secret) +_jpush.set_logging("DEBUG") +schedule = _jpush.create_schedule() + +def delete_schedule(): + schedule.delete_schedule("e9c553d0-0850-11e6-b6d4-0021f652c102") + +def get_schedule(): + schedule.get_schedule_by_id("e9c553d0-0850-11e6-b6d4-0021f652c102") + +def get_schedule(): + schedule.get_schedule_list("1") + +def post_schedule(): + push = _jpush.create_push() + push.audience = jpush.all_ + push.notification = jpush.notification(alert="Hello, world!") + push.platform = jpush.all_ + push=push.payload + + trigger=jpush.schedulepayload.trigger("2016-07-17 12:00:00") + schedulepayload=jpush.schedulepayload.schedulepayload("name",True,trigger,push) + result=schedule.post_schedule(schedulepayload) + print (result.status_code) + +def put_schedule(): + push = _jpush.create_push() + push.audience = jpush.all_ + push.notification = jpush.notification(alert="Hello, world!") + push.platform = jpush.all_ + push=push.payload + + trigger=jpush.schedulepayload.trigger("2016-05-17 12:00:00") + schedulepayload=jpush.schedulepayload.schedulepayload("update a new name", True, trigger, push) + schedule.put_schedule(schedulepayload,"17349f00-0852-11e6-91b1-0021f653c902") \ No newline at end of file diff --git a/examples/schedule_examples/example_delete_schedule.py b/examples/schedule_examples/example_delete_schedule.py deleted file mode 100644 index edd7980..0000000 --- a/examples/schedule_examples/example_delete_schedule.py +++ /dev/null @@ -1,6 +0,0 @@ -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") diff --git a/examples/schedule_examples/example_get_schedule.py b/examples/schedule_examples/example_get_schedule.py deleted file mode 100644 index 67f44bf..0000000 --- a/examples/schedule_examples/example_get_schedule.py +++ /dev/null @@ -1,6 +0,0 @@ -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") diff --git a/examples/schedule_examples/example_get_schedule_list.py b/examples/schedule_examples/example_get_schedule_list.py deleted file mode 100644 index c287c69..0000000 --- a/examples/schedule_examples/example_get_schedule_list.py +++ /dev/null @@ -1,6 +0,0 @@ -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 diff --git a/examples/schedule_examples/example_post_schedule.py b/examples/schedule_examples/example_post_schedule.py deleted file mode 100644 index b92728e..0000000 --- a/examples/schedule_examples/example_post_schedule.py +++ /dev/null @@ -1,17 +0,0 @@ -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() -push.audience = jpush.all_ -push.notification = jpush.notification(alert="Hello, world!") -push.platform = jpush.all_ -push=push.payload - -trigger=jpush.schedulepayload.trigger("2016-07-17 12:00:00") -schedulepayload=jpush.schedulepayload.schedulepayload("name",True,trigger,push) -result=schedule.post_schedule(schedulepayload) -print (result.status_code) diff --git a/examples/schedule_examples/example_put_schedule.py b/examples/schedule_examples/example_put_schedule.py deleted file mode 100644 index def09cb..0000000 --- a/examples/schedule_examples/example_put_schedule.py +++ /dev/null @@ -1,15 +0,0 @@ -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() -push.audience = jpush.all_ -push.notification = jpush.notification(alert="Hello, world!") -push.platform = jpush.all_ -push=push.payload - -trigger=jpush.schedulepayload.trigger("2016-05-17 12:00:00") -schedulepayload=jpush.schedulepayload.schedulepayload("update a new name", True, trigger, push) -schedule.put_schedule(schedulepayload,"17349f00-0852-11e6-91b1-0021f653c902") \ No newline at end of file