how?: Interrogate print status from command line


Is it possible to interrogate octoprint from the command line to get print status details and similar information?
I want to be able to write bash/python/whatever scripts to pull simple statistics from the active octoprint it MUST be from the command prompt. ... wget/curl if necessary.


Try the CLI:

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

  Basic API client.

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

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

Or use curl with the API.

Can I use octoprint server as library in my python tool

Thank you. This answers one part of my question. And this answers the rest.