Fanspeed, Position extruder data in Python with REST API

What is the problem?

I cannot manage to get the current fanspeed, feedrate and position of the extruder head with REST API in Python. I read on some forums that this is not possible but I was wondering if there is any other/new way to get this data. The goal in the end is to collect as many printer variables as possible while printing to do some analysis.

What did you already try to solve it?

I managed to get the temperature data of the extruder and the bed with REST API and I can post commands for the fanspeed for example.

I use Octoprint with my laptop connected to a Prusa MK3s

This is actually covered in the very documentation of the API endpoints:

1 Like

Thanks for your answer! Do you know what python code to use for push updates? I cannot find any code

There's a basic client available on the command line:

$ octoprint client --help
Usage: octoprint client [OPTIONS] COMMAND [ARGS]...

  Basic API client.

Options:
  -a, --apikey TEXT
  -h, --host TEXT
  -p, --port INTEGER
  --httpuser TEXT
  --httppass TEXT
  --https
  --prefix TEXT
  --help              Show this message and exit.

Commands:
  command         Sends a JSON command to the specified server path.
  delete          Sends a DELETE request to the specified server path.
  get             Performs a GET request against the specified server path.
  listen
  patch_json      PATCHes JSON data to the specified server path.
  post_from_file  POSTs JSON data to the specified server path, taking the...
  post_json       POSTs JSON data to the specified server path.
  upload          Uploads the specified file to the specified server path.

The listen sub command is a basic push socket client that simply logs what it receives. The socket client is implemented in octoprint_client.Client#create_socket.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.