Created
August 13, 2017 17:41
-
-
Save luisfcorreia/dd802c1cad64b099a74ae2ab786f2ad2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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