24 lines
465 B
Python
Executable file
24 lines
465 B
Python
Executable file
#!/usr/bin/python3
|
|
import sys
|
|
|
|
import ox.api
|
|
|
|
site = sys.argv[1]
|
|
prefix = 'cnv'
|
|
api = ox.api.signin(site)
|
|
|
|
n = 1
|
|
for item in api.find({
|
|
'query': {
|
|
'conditions': [{'key': 'title', 'value': prefix, 'operator': '^'}]
|
|
},
|
|
'keys': ['id', 'title'],
|
|
'sort': [{'key': 'created', 'operator': '+'}],
|
|
'range': [0, 10000]
|
|
})['data']['items']:
|
|
api.edit({
|
|
'id': item['id'],
|
|
'title': '%s %s' % (n, item['title']),
|
|
})
|
|
n += 1
|
|
|