custom_http_endpoint.py example - http error 500?
-
We are evaluating the custom_http_endpoint.py example located at
https://github.com/Duet3D/dsf-python/blob/main/examples/custom_http_endpoint.py. We are running dsf-python-3.4.6.post4. The example is returning a 500 error and we are unsure how to debug it to move past it. Here is the output from the console while running:send: {"mode":"Command","version":12} recv: {"success":true} send: {"command":"AddHttpEndpoint","EndpointType":"GET","Namespace":"custom","Path":"getIt","IsUploadRequest":false} recv: {"result":"/run/dsf/custom/getIt-GET.sock","success":true} Try accessing http://duet3.local/machine/custom/getIt in your browser...
Any thoughts on what might be wrong? Thanks in advance.
-
Bump.. So far I have not been able to find any logging or details on why it is returning a 500 error. Note that any invalid URL returns 404, so DSF is picking up that it's been registered.
Maybe the example is from a previous version of dsf-python and needs updating? Please advise as we do have a use for this and are quite motivated to put it into practice. Thanks
-
-
@oozeBot Are you running this script as root or as a user that is not part of the
dsf
group? To debug this problem, you'd have to look in theduetwebserver
journalctl log, which generates a message when it fails to access your custom HTTP endpoint.If you run it as
root
, you need to change the ownership of the corresponding socket file (/run/dsf/custom/getIt-GET.sock
) todsf
before the web server (running asdsf
user) can access it. -
@chrishamm Thanks! That’s the nudge we needed- It’s definitely a permission issue. We’ll get it sorted.
-