Commit b6f258b6 authored by hupantingxue's avatar hupantingxue

Add sample code and docs;

parent 3cc87909
...@@ -6,14 +6,14 @@ Common setup: ...@@ -6,14 +6,14 @@ Common setup:
.. code-block:: python .. code-block:: python
import jpush as jpush import jpush as jpush
jpush = jpush.JPush(app_key, master_secret) _jpush = jpush.JPush(app_key, master_secret)
Simple broadcast to all devices Simple broadcast to all devices
------------------------------- -------------------------------
.. code-block:: python .. code-block:: python
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!")
push.platform = jpush.all_ push.platform = jpush.all_
...@@ -25,7 +25,7 @@ Complex audience with iOS & Android specifics ...@@ -25,7 +25,7 @@ Complex audience with iOS & Android specifics
.. code-block:: python .. code-block:: python
push = jpush.create_push() push = _jpush.create_push()
push.audience = jpush.audience( push.audience = jpush.audience(
jpush.tag("breakingnews"), jpush.tag("breakingnews"),
jpush.tag_and("sports"), jpush.tag_and("sports"),
...@@ -51,7 +51,7 @@ Single iOS push ...@@ -51,7 +51,7 @@ Single iOS push
.. code-block:: python .. code-block:: python
push = jpush.create_push() push = _jpush.create_push()
push.audience = jpush.registration_id('fffffffffff') push.audience = jpush.registration_id('fffffffffff')
push.notification = jpush.notification( push.notification = jpush.notification(
ios=jpush.ios(alert="JPush powers your apps")) ios=jpush.ios(alert="JPush powers your apps"))
......
app_key = u'dd1066407b044738b6479275'
master_secret = u'2b38ce69b1de2a7fa95706ea'
import jpush as jpush
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
push = _jpush.create_push()
push.audience = jpush.all_
push.notification = jpush.notification(alert="Hello, world!")
push.platform = jpush.all_
push.send()
...@@ -2,7 +2,7 @@ import json ...@@ -2,7 +2,7 @@ import json
import logging import logging
BASE_URL = "https://api.jpush.cn:15088/" BASE_URL = "https://api.jpush.cn/"
PUSH_URL = BASE_URL + 'v3/push/' PUSH_URL = BASE_URL + 'v3/push/'
logger = logging.getLogger('jpush') logger = logging.getLogger('jpush')
......
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