Improve submit script
This commit is contained in:
parent
0aece8b8ca
commit
bc78ac5775
1 changed files with 8 additions and 5 deletions
11
submit.py
Normal file → Executable file
11
submit.py
Normal file → Executable file
|
@ -1,10 +1,12 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import os
|
||||||
import json
|
import json
|
||||||
import requests
|
import requests
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
SERVER = os.getenv("LEDSTRIP_SERVER", "http://10.1.0.212:8080")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
|
@ -13,11 +15,12 @@ for i in range(10):
|
||||||
c = codefile.read()
|
c = codefile.read()
|
||||||
except:
|
except:
|
||||||
continue
|
continue
|
||||||
j = {
|
|
||||||
|
payload = {
|
||||||
"code": c,
|
"code": c,
|
||||||
"owner": "j",
|
"owner": "j",
|
||||||
"id": i
|
"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)
|
||||||
print(r.text)
|
print(r.text)
|
Loading…
Reference in a new issue