Commit 2a55b955 authored by Helperhaps's avatar Helperhaps

add tag_not in audience

parent 9f3aafe5
...@@ -55,6 +55,18 @@ tags 例如:tag_and("tag1", "tag2") ...@@ -55,6 +55,18 @@ tags 例如:tag_and("tag1", "tag2")
返回值 返回值
> payload 字典 > payload 字典
##### tag_not 设置
```
tag_not(*tag_nots)
```
参数说明
tags 例如:tag_not("tag1", "tag2")
返回值
> payload 字典
##### alias 设置 ##### alias 设置
``` ```
alias(*alias) alias(*alias)
......
...@@ -7,6 +7,7 @@ from .push import ( ...@@ -7,6 +7,7 @@ from .push import (
all_, all_,
tag, tag,
tag_and, tag_and,
tag_not,
alias, alias,
registration_id, registration_id,
notification, notification,
...@@ -48,6 +49,7 @@ __all__ = [ ...@@ -48,6 +49,7 @@ __all__ = [
Push, Push,
tag, tag,
tag_and, tag_and,
tag_not,
alias, alias,
registration_id, registration_id,
notification, notification,
...@@ -71,7 +73,7 @@ __all__ = [ ...@@ -71,7 +73,7 @@ __all__ = [
schedulepayload, schedulepayload,
] ]
__version__ = '3.2.5' __version__ = '3.2.6'
VERSION = tuple(map(int, __version__.split('.'))) VERSION = tuple(map(int, __version__.split('.')))
# Silence urllib3 INFO logging by default # Silence urllib3 INFO logging by default
......
...@@ -3,6 +3,7 @@ from .core import Push ...@@ -3,6 +3,7 @@ from .core import Push
from .audience import ( from .audience import (
tag, tag,
tag_and, tag_and,
tag_not,
alias, alias,
registration_id, registration_id,
) )
...@@ -32,6 +33,7 @@ __all__ = [ ...@@ -32,6 +33,7 @@ __all__ = [
Push, Push,
tag, tag,
tag_and, tag_and,
tag_not,
alias, alias,
registration_id, registration_id,
notification, notification,
......
...@@ -12,6 +12,11 @@ def tag_and(*tag_ands): ...@@ -12,6 +12,11 @@ def tag_and(*tag_ands):
vtag_and = [t for t in tag_ands] vtag_and = [t for t in tag_ands]
return {"tag_and": vtag_and} return {"tag_and": vtag_and}
def tag_not(*tag_nots):
"""Select a (list of) tag_not(s)."""
vtag_not = [t for t in tag_nots]
return {"tag_not": vtag_not}
def alias(*alias): def alias(*alias):
"""Select a (list of) alias(es).""" """Select a (list of) alias(es)."""
valias = [t for t in alias] valias = [t for t in alias]
......
...@@ -196,7 +196,7 @@ def audience(*types): ...@@ -196,7 +196,7 @@ def audience(*types):
audience = {} audience = {}
for t in types: for t in types:
for key in t: for key in t:
if key not in ('tag', 'tag_and', 'alias', 'registration_id'): if key not in ('tag', 'tag_and', 'tag_not', 'alias', 'registration_id'):
raise ValueError("Invalid audience '%s'" % t) raise ValueError("Invalid audience '%s'" % t)
audience[key] = t[key] audience[key] = t[key]
return audience return audience
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