CLI tool to control your IoT gadgets.
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.
roomcomputer/hue_controller.py

16 lines
440 B

import requests as req # Used for HTTP requests for the Hue API
import json # API uses JSON
import config # Configuration for the controller
def genUrl(params: str):
return "https://" + config.address + "/api/" + config.username + params
def API_Request(ReqType: str, params: str):
apiReq = req.Request( ReqType, genUrl(params) )
apiReqPrep = apiReq.prepare()
apiSession = req.Session()
apiSession.send(apiReqPrep)