add number

This commit is contained in:
j 2018-08-05 18:41:18 +01:00
parent a33b99b71c
commit 11b4d7d3a2
1 changed files with 19 additions and 0 deletions

19
add_number.py Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/python3
import ox.api
api = ox.api.signin('https://amp.0x2620.org/api/')
n = 1
for item in api.find({
'condtions': [{'key': 'title', 'value': 'cnv', '^'}],
'keys': ['id', 'title'],
'sort': [{'key': 'created', 'order': '+'}],
'range': [0, 10000]
})['data']['items']:
api.edit({
'id': item['id'],
'title': '%s %s' % (n, item['title']),
})
n += 1