Skip to content

Instantly share code, notes, and snippets.

@luisfcorreia
Created August 13, 2017 17:41
Show Gist options
  • Save luisfcorreia/dd802c1cad64b099a74ae2ab786f2ad2 to your computer and use it in GitHub Desktop.
Save luisfcorreia/dd802c1cad64b099a74ae2ab786f2ad2 to your computer and use it in GitHub Desktop.
import json
import requests
gramofon_ip = '127.0.0.1'
ori_sid = '00000000000000000000000000000000'
baseuri = 'http://' + gramofon_ip + '/api/'
# login to get a SID
dataj = {"jsonrpc":"2.0","id":"69","method":"call","params":["session","login",{"username":"admin","password":"admin"}]}
r = requests.post(baseuri + ori_sid , json=dataj)
sid = json.loads(r.text)['result'][1]['sid']
# shut that LED off!
dataj = {"jsonrpc":"2.0","id":"69","method":"call","params":["ledd","switch",{"status":"disable"}]}
r = requests.post(baseuri + sid , json=dataj)
print(r.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment