1
|
|
2
|
|
3
|
'''Ce script supprime TOUTES les tâches redmines du projet indiqué. À utiliser avec prudence.
|
4
|
'''
|
5
|
|
6
|
import requests
|
7
|
import json
|
8
|
import sys
|
9
|
|
10
|
import constantes as const
|
11
|
|
12
|
print('Ce script supprime TOUTES les tâches redmines du projet indiqué. À utiliser avec prudence.')
|
13
|
ok = input('Continuer ? (oui/non) : ')
|
14
|
|
15
|
if ok == 'oui':
|
16
|
const.Headers_GET['X-Redmine-API-Key'] = const.SUBMITERS[const.MANAGER]
|
17
|
r = requests.get(const.URL_ISSUES_JSON + '?status_id=*&limit=100', headers=const.Headers_GET)
|
18
|
|
19
|
taches_json = json.loads(r.text)['issues']
|
20
|
|
21
|
sys.stdout.write('Pourcentage de complétion : 00%\b\b\b')
|
22
|
sys.stdout.flush()
|
23
|
compt = 0
|
24
|
for tache in taches_json:
|
25
|
tid = tache['id']
|
26
|
r = requests.delete(const.URL_REDMINE + '/issues/{}.json'.format(tid), headers=const.Headers_GET)
|
27
|
|
28
|
|
29
|
compt += 1
|
30
|
pourcentage = compt/len(taches_json)*100
|
31
|
sys.stdout.write(str(pourcentage) + '%\b\b\b')
|
32
|
sys.stdout.flush()
|
33
|
else:
|
34
|
print('Sage décision')
|