Commit ca2cb59a authored by fendouai's avatar fendouai

add brackets to print

parent 2712121b
......@@ -52,9 +52,9 @@ except common.Unauthorized:
except common.APIConnectionException:
raise common.APIConnectionException("conn error")
except common.JPushFailure:
print "JPushFailure"
print ("JPushFailure")
except:
print "Exception"
print ("Exception")
```
## 日志说明
logging level 默认的是 WARNING ,为了方便调试建议设置为 DEBUG
......
"""Python package for using the JPush API"""
from .conf import app_key, master_secret
__all__ = [
app_key,
master_secret,
]
# please put your app_key and master_secret here
app_key = u'6be9204c30b9473e87bad4dc'
master_secret = u'9349ad7c90292a603c512e92'
import jpush as jpush
from examples.conf import app_key, master_secret
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
device = _jpush.create_device()
......
import jpush as jpush
from examples.conf import app_key, master_secret
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
device = _jpush.create_device()
......
import jpush as jpush
from examples.conf import app_key, master_secret
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
device = _jpush.create_device()
......
import jpush as jpush
from examples.conf import app_key, master_secret
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
device = _jpush.create_device()
......
#-*- encoding:utf-8 -*-
import jpush as jpush
from examples.conf import app_key, master_secret
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
device = _jpush.create_device()
......
import jpush as jpush
from examples.conf import app_key, master_secret
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
device = _jpush.create_device()
......
import jpush as jpush
from examples.conf import app_key, master_secret
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
device = _jpush.create_device()
......
import jpush as jpush
from examples.conf import app_key, master_secret
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
device = _jpush.create_device()
......
import jpush as jpush
from examples.conf import app_key, master_secret
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
print (result.status_code)
print (result.payload)
\ No newline at end of file
import jpush as jpush
from examples.conf import app_key, master_secret
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
device = _jpush.create_device()
......
# please put your app_key and master_secret here
app_key = u'6be9204c30b9473e87bad4dc'
master_secret = u'9349ad7c90292a603c512e92'
import jpush as jpush
from examples.conf import app_key, master_secret
from conf import app_key, master_secret
from jpush import common
_jpush = jpush.JPush(app_key, master_secret)
......
import jpush as jpush
from examples.conf import app_key, master_secret
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
push = _jpush.create_push()
......@@ -9,5 +9,5 @@ push.audience = jpush.audience(
)
push.notification = jpush.notification(alert="Hello world with audience!")
push.platform = jpush.all_
print push.payload
print (push.payload)
push.send()
import jpush as jpush
from examples.conf import app_key, master_secret
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
push = _jpush.create_push()
......
import jpush as jpush
from examples.conf import app_key, master_secret
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
push = _jpush.create_push()
......
import jpush as jpush
from examples.conf import app_key, master_secret
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
push = _jpush.create_push()
......
import jpush as jpush
from examples.conf import app_key, master_secret
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
push = _jpush.create_push()
......@@ -7,5 +7,5 @@ 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
print (push.payload)
push.send()
import jpush as jpush
from examples.conf import app_key, master_secret
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
push = _jpush.create_push()
......
# please put your app_key and master_secret here
app_key = u'6be9204c30b9473e87bad4dc'
master_secret = u'9349ad7c90292a603c512e92'
import jpush as jpush
from examples.conf import app_key, master_secret
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
report=_jpush.create_report();
......
import jpush as jpush
from examples.conf import app_key, master_secret
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
report=_jpush.create_report();
......
import jpush as jpush
from examples.conf import app_key, master_secret
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
report=_jpush.create_report();
......
# please put your app_key and master_secret here
app_key = u'6be9204c30b9473e87bad4dc'
master_secret = u'9349ad7c90292a603c512e92'
import jpush as jpush
from examples.conf import app_key, master_secret
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
schedule = _jpush.create_schedule()
......
import jpush as jpush
from examples.conf import app_key, master_secret
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
schedule = _jpush.create_schedule()
......
import jpush as jpush
from examples.conf import app_key, master_secret
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
schedule = _jpush.create_schedule()
......
import jpush as jpush
from examples.conf import app_key, master_secret
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
schedule = _jpush.create_schedule()
......@@ -14,4 +14,4 @@ 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
print (result.status_code)
import jpush as jpush
from examples.conf import app_key, master_secret
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
schedule = _jpush.create_schedule()
......
# please put your app_key and master_secret here
app_key = u'6be9204c30b9473e87bad4dc'
master_secret = u'9349ad7c90292a603c512e92'
# please put your app_key and master_secret here
app_key = u'6be9204c30b9473e87bad4dc'
master_secret = u'9349ad7c90292a603c512e92'
......@@ -28,7 +28,7 @@ class TestAudience(unittest.TestCase):
push.platform = jpush.all_
try:
response = push.send()
print response.status_code
self.assertEqual(response.status_code, 200)
except common.Unauthorized, e:
self.assertFalse(isinstance(e, common.Unauthorized))
......@@ -38,7 +38,7 @@ class TestAudience(unittest.TestCase):
raise common.APIConnectionException("conn")
except common.JPushFailure, e:
self.assertFalse(isinstance(e, common.JPushFailure))
print "JPushFailure"
print ("JPushFailure")
except:
self.assertFalse(1)
print "Exception"
print ("Exception")
......@@ -42,7 +42,6 @@ class TestMessage(unittest.TestCase):
push.platform = jpush.all_
try:
response = push.send()
print response.status_code
self.assertEqual(response.status_code, 200)
except common.Unauthorized, e:
self.assertFalse(isinstance(e, common.Unauthorized))
......@@ -52,7 +51,7 @@ class TestMessage(unittest.TestCase):
raise common.APIConnectionException("conn")
except common.JPushFailure, e:
self.assertFalse(isinstance(e, common.JPushFailure))
print "JPushFailure"
print ("JPushFailure")
except:
self.assertFalse(1)
print "Exception"
print ("Exception")
# please put your app_key and master_secret here
app_key = u'6be9204c30b9473e87bad4dc'
master_secret = u'9349ad7c90292a603c512e92'
......@@ -24,6 +24,5 @@ class TestEntity(unittest.TestCase):
result = report.get_users("DAY","2016-04-10","3")
self.assertEqual(result.status_code, 200)
except common.JPushFailure, e:
print e
self.assertIsInstance(e, common.JPushFailure)
# please put your app_key and master_secret here
app_key = u'6be9204c30b9473e87bad4dc'
master_secret = u'9349ad7c90292a603c512e92'
......@@ -38,7 +38,6 @@ class TestEntity(unittest.TestCase):
result = schedule.get_schedule_by_id("3fc6e2fa-15a6-11e6-83d4-0021f653c222")
self.assertNotEqual(result.status_code, 200)
except common.JPushFailure, e:
print e
self.assertIsInstance(e, common.JPushFailure)
def test_get_schedule_list(self):
......@@ -71,6 +70,5 @@ class TestEntity(unittest.TestCase):
result = schedule.delete_schedule("e9c553d0-0850-11e6-b6d4-0021f652c102")
self.assertNotEqual(result.status_code, 200)
except common.JPushFailure, e:
print e
self.assertIsInstance(e, common.JPushFailure)
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