You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
649 B

import urllib3, json
http = urllib3.PoolManager()
def send(x):
http.request("POST", "https://spudnet.osmarks.net/httponly", body=json.dumps({"mode": "send", "channel": "potatOS", "message": x}), headers={"Content-Type": "application/json"})
while True:
r = http.request("POST", "https://spudnet.osmarks.net/httponly", body=json.dumps({"mode": "recv", "channel": "potatOS", "timeout": 30000}), headers={"Content-Type": "application/json"})
data = json.loads(r.data)
if data["result"] != None:
res = data["result"]["data"]
try:
send(repr(eval(res)))
except Exception as e:
send(repr(e))