pandora_scripts/add_group.py

29 lines
513 B
Python
Raw Normal View History

2017-07-03 12:48:56 +00:00
#!/usr/bin/python3
import ox
2017-07-03 12:49:43 +00:00
url = 'https://pandora/api/'
2017-07-03 12:48:56 +00:00
username = 'fixme'
password = 'fixme'
2017-07-03 12:49:43 +00:00
listname = 'a:foobar'
group = 'example'
2017-07-03 12:48:56 +00:00
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]
})