diff --git a/add_group.py b/add_group.py new file mode 100755 index 0000000..af8169d --- /dev/null +++ b/add_group.py @@ -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] + })