Commit 2a55b955 authored by Helperhaps's avatar Helperhaps

add tag_not in audience

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