HTTP Requests stuff

fetchIP
E. Almqvist 4 years ago
parent 7892ec7ead
commit 7afb5b55b3
  1. 2
      .gitignore
  2. BIN
      __pycache__/config.cpython-38.pyc
  3. 4
      config_default.json
  4. 2
      default-config.py
  5. 15
      hue_controller.py
  6. 7
      main.py

2
.gitignore vendored

@ -1,2 +1,2 @@
config.json config.py
lib/__pycache__/ lib/__pycache__/

Binary file not shown.

@ -1,4 +0,0 @@
{
"username": "YOUR USERNAME HERE",
"address": "IP ADDRESS FOR THE HUE BRIDGE"
}

@ -0,0 +1,2 @@
address = ""
username = ""

@ -0,0 +1,15 @@
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)

@ -1,8 +1,9 @@
#!/usr/bin/env python #!/usr/bin/env python
import requests as req # Used for HTTP requests for the Hue API
from lib.input import * # Commandline parser from lib.input import * # Commandline parser
import hue_controller # Actual controller
def init():
init()
Loading…
Cancel
Save