Razer Chroma POST Request hangs Python Script indefinitely

104 Views Asked by At

I've been trying to use the Razer Chroma REST API to alter the lighting on my peripherals, but I've been stopped at the first hurdle.

According to the Documentation, to initialise a connection, you need to send a POST request to http://localhost:54235/razer/chromasdk, with a json payload containing the application data, but when I do this, my Python script just hangs indefinitely. No errors, no responses, it just stops at that point. The code I've been using is as below:

import requests
data = {
"title": "Razer Chroma SDK RESTful Test Application",
"description": "This is a REST interface test application",
"author": {
    "name": "Chroma Developer",
    "contact": "www.razerzone.com"
},
"device_supported": [
    "keyboard",
    "mouse",
    "headset",
    "mousepad",
    "keypad",
    "chromalink"],
"category": "application"
}
url = "http://localhost:54235/razer/chromasdk"
r = requests.post(url, json=data)
print(r.status_code)

The POST request should return a payload containing a session ID and a URI to use, or otherwise a failure response, as stated here. I've confirmed the target URL exists on my PC, as running the following code:

url = "http://localhost:54235/razer/chromasdk"
r = requests.get(url)
print(r.text)"

returns {"core":"3.26.00","device":"3.26.00","version":"3.26.00"}, as expected.

Any help or insight would be greatly appreciated, thanks!

0

There are 0 best solutions below