pandora_scripts/add_group.py
2017-07-03 15:49:43 +03:00

28 lines
513 B
Python
Executable file

#!/usr/bin/python3
import ox
url = 'https://pandora/api/'
username = 'fixme'
password = 'fixme'
listname = 'a:foobar'
group = 'example'
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]
})