Commit 3cc87909 authored by hupantingxue's avatar hupantingxue

Update setup scripts;

parent 3380379e
...@@ -2,7 +2,7 @@ import json ...@@ -2,7 +2,7 @@ import json
import logging import logging
BASE_URL = "https://api.jpush.cn/" BASE_URL = "https://api.jpush.cn:15088/"
PUSH_URL = BASE_URL + 'v3/push/' PUSH_URL = BASE_URL + 'v3/push/'
logger = logging.getLogger('jpush') logger = logging.getLogger('jpush')
......
...@@ -22,7 +22,12 @@ def audience(*children): ...@@ -22,7 +22,12 @@ def audience(*children):
"""Select audience that match all of the given selectors. """Select audience that match all of the given selectors.
>>> audience(tag('sports'), tag_and('business')) >>> audience(tag('sports'), tag_and('business'))
{'audience': {'tag': 'sports'}, {'tag_and': 'business'}} {'audience': {'tag':'sports', 'tag_and':'business'}}
""" """
return {"audience": [child for child in children]} if len(types) == 1 and types[0] == 'all':
return {'audience':'all'}
for t in types:
if t not in ('tag', 'tag_and', 'alias', 'registration_id'):
raise ValueError("Invalid platform '%s'" % t)
return [t for t in types]
...@@ -9,7 +9,7 @@ class Push(object): ...@@ -9,7 +9,7 @@ class Push(object):
"""A push notification. Set audience, message, etc, and send.""" """A push notification. Set audience, message, etc, and send."""
def __init__(self, jpush): def __init__(self, jpush):
self._jpush = jpush self._jpush = jpush
self.audience = None self.audience = None
self.notification = None self.notification = None
self.platform = None self.platform = None
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
try:
from setuptools import setup from setuptools import setup
except (ImportError):
from distutils.core import setup
from jpush import __version__ from jpush import __version__
setup( setup(
name='jpush', name='jpush',
version=__version__, version=__version__,
...@@ -17,7 +18,7 @@ setup( ...@@ -17,7 +18,7 @@ setup(
author='hupantingxue', author='hupantingxue',
author_email='hupantingxue@126.com', author_email='hupantingxue@126.com',
packages=['jpush'], packages=['jpush', 'jpush.push'],
platforms='any', platforms='any',
classifiers=[ classifiers=[
'Environment :: Console', 'Environment :: Console',
...@@ -26,4 +27,8 @@ setup( ...@@ -26,4 +27,8 @@ setup(
'Operating System :: OS Independent', 'Operating System :: OS Independent',
'Programming Language :: Python', 'Programming Language :: Python',
], ],
install_requires=[
'requests>=1.2',
],
) )
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