-
Notifications
You must be signed in to change notification settings - Fork 0
Format JSON
daufinsyd edited this page Mar 8, 2017
·
7 revisions
Format des reponses json
serveur:
{
"0":{"codeCmd":"0","cmd":"ls","params":["a","r"]},
"1":{"codeCmd":"1","cmd":1,"params":["param1","param2"]}
}
0: commande bash (seulement pour admin)
1: fonction définie en python
2: setMaxVol
- On exécute d'abord les fonctions bash
- Puis les fonctions définies (hors exctinction / reboot)
- Enfin reboot / shutdown si demandé
valeurs de cmd si codeCmd est égal à 1
1: update
2: upgrade
3: distupgrade
10: reboot
rep = requests.post('http://127.0.0.1:8000/wthit/imbored', data=data)
rep.json()[i] # i = index
import json
with open('test.json') as json_file:
data=json.load(json_file)
data["0"]["codeCmd"]...