Commit b4e1c930 authored by fendouai's avatar fendouai

remove print,add logging debug

parent df5d7020
Version 3.2.0
-----------
**Released 2015 Nov 9**
Add push sms message api;
Version 3.1.0
-----------
**Released 2015 Nov 9**
......
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"
......
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("")
......
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)
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"
......
......@@ -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"
......
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'
......
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()
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"))
......
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"))
......
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")
......
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"),
......
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!")
......
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'})
......
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)
......
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")
......
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!")
......
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
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
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
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")
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")
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
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()
......
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()
......
......@@ -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
......
......@@ -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)
......
......@@ -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
......
......@@ -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
......
......@@ -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',
......
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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment