add group
This commit is contained in:
parent
b37d1c2130
commit
7f0fba8c14
1 changed files with 28 additions and 0 deletions
28
add_group.py
Executable file
28
add_group.py
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import ox
|
||||
|
||||
url = 'https://'
|
||||
listname = 'a:foobar'
|
||||
group = 'example'
|
||||
username = 'fixme'
|
||||
password = 'fixme'
|
||||
|
||||
|
||||
api = ox.API(url)
|
||||
api.signin(username=username, password=password)
|
||||
for item in api.find({
|
||||
'query': {
|
||||
'conditions': [{
|
||||
'key': 'list',
|
||||
'value': listname,
|
||||
'operator': '=='
|
||||
}]
|
||||
},
|
||||
'keys': ['id'],
|
||||
'range': [0, 5000]
|
||||
})['data']['items']:
|
||||
api.edit({
|
||||
'id': item['id'],
|
||||
'groups': [group]
|
||||
})
|
Loading…
Reference in a new issue