add group

This commit is contained in:
j 2017-07-03 15:48:56 +03:00
parent b37d1c2130
commit 7f0fba8c14

28
add_group.py Executable file
View 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]
})