Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jpush-api-python-client
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
jpush-api-python-client
Commits
701084bb
Commit
701084bb
authored
Sep 18, 2014
by
hupantingxue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify tags device entity;
parent
da9e1f05
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
example_updevice.py
examples/device/example_updevice.py
+1
-0
entity.py
jpush/device/entity.py
+6
-6
No files found.
examples/device/example_updevice.py
View file @
701084bb
...
@@ -5,4 +5,5 @@ _jpush = jpush.JPush(app_key, master_secret)
...
@@ -5,4 +5,5 @@ _jpush = jpush.JPush(app_key, master_secret)
device
=
_jpush
.
create_device
()
device
=
_jpush
.
create_device
()
reg_id
=
'090c1f59f89'
reg_id
=
'090c1f59f89'
entity
=
jpush
.
device_tag
(
jpush
.
add
(
"ddd"
,
"tageee"
))
entity
=
jpush
.
device_tag
(
jpush
.
add
(
"ddd"
,
"tageee"
))
#entity = jpush.device_tag("")
device
.
set_deviceinfo
(
reg_id
,
entity
)
device
.
set_deviceinfo
(
reg_id
,
entity
)
jpush/device/entity.py
View file @
701084bb
...
@@ -31,22 +31,22 @@ def device_tag(*types):
...
@@ -31,22 +31,22 @@ def device_tag(*types):
"""Get a tag object
"""Get a tag object
>>> device_tag("")
>>> device_tag("")
{'tag': ''}
{'tag
s
': ''}
>>> device_tag("tag1")
>>> device_tag("tag1")
{'tag': 'tag1'}
{'tag
s
': 'tag1'}
>>> device_tag(add("tag1", "tag2"), remove("tag3", "tag4"))
>>> device_tag(add("tag1", "tag2"), remove("tag3", "tag4"))
{'tag': {'add': ['tag1', 'tag2'], 'remove': ['tag3', 'tag4']}}
{'tag
s
': {'add': ['tag1', 'tag2'], 'remove': ['tag3', 'tag4']}}
"""
"""
tag
=
{}
tag
=
{}
if
1
==
len
(
types
)
and
isinstance
(
types
[
0
],
(
str
,
unicode
)):
if
1
==
len
(
types
)
and
isinstance
(
types
[
0
],
(
str
,
unicode
)):
tag
[
"tag"
]
=
types
[
0
]
tag
[
"tag
s
"
]
=
types
[
0
]
return
tag
return
tag
tag
[
"tag"
]
=
{}
tag
[
"tag
s
"
]
=
{}
for
t
in
types
:
for
t
in
types
:
for
key
in
t
:
for
key
in
t
:
if
key
not
in
(
'add'
,
'remove'
):
if
key
not
in
(
'add'
,
'remove'
):
raise
ValueError
(
"Invalid tag '
%
s'"
%
t
)
raise
ValueError
(
"Invalid tag '
%
s'"
%
t
)
tag
[
"tag"
][
key
]
=
t
[
key
]
tag
[
"tag
s
"
][
key
]
=
t
[
key
]
return
tag
return
tag
def
device_alias
(
*
types
):
def
device_alias
(
*
types
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment