Improve submit script

This commit is contained in:
Midgard 2021-09-19 03:49:00 +02:00
parent 0aece8b8ca
commit bc78ac5775
Signed by: midgard
GPG key ID: 511C112F1331BBB4

11
submit.py Normal file → Executable file
View file

@ -1,10 +1,12 @@
#!/usr/bin/env python3
import os
import json
import requests
import time
SERVER = os.getenv("LEDSTRIP_SERVER", "http://10.1.0.212:8080")
for i in range(10):
@ -13,11 +15,12 @@ for i in range(10):
c = codefile.read()
except:
continue
j = {
payload = {
"code": c,
"owner": "j",
"id": i
}
r = requests.put('http://10.1.0.212:8080/api/code.json', json=j)
r = requests.put(SERVER + '/api/code.json', json=payload)
print(r)
print(r.text)