2021-09-19 03:49:00 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import os
|
2021-09-16 14:27:35 +02:00
|
|
|
import json
|
|
|
|
import requests
|
|
|
|
import time
|
|
|
|
|
|
|
|
|
2021-09-19 03:49:00 +02:00
|
|
|
SERVER = os.getenv("LEDSTRIP_SERVER", "http://10.1.0.212:8080")
|
2021-09-16 14:27:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
for i in range(10):
|
|
|
|
try:
|
|
|
|
with open(f'demo/{i}.lua') as codefile:
|
|
|
|
c = codefile.read()
|
|
|
|
except:
|
|
|
|
continue
|
2021-09-19 03:49:00 +02:00
|
|
|
|
|
|
|
payload = {
|
2021-09-16 14:27:35 +02:00
|
|
|
"code": c,
|
|
|
|
"owner": "j",
|
|
|
|
"id": i
|
|
|
|
}
|
2021-09-19 03:49:00 +02:00
|
|
|
r = requests.put(SERVER + '/api/code.json', json=payload)
|
2021-09-16 14:27:35 +02:00
|
|
|
print(r)
|
2021-09-19 03:49:00 +02:00
|
|
|
print(r.text)
|