Skip to content

Commit 6a0c7af

Browse files
committed
Add method to get notebook server version
* jupyter-rest-api.el (jupyter-api-server-version): New function.
1 parent 37613ab commit 6a0c7af

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

jupyter-rest-api.el

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,18 @@ the server."
752752

753753
;;;; Endpoints
754754

755+
(cl-defmethod jupyter-api-server-version ((client jupyter-rest-client))
756+
"Return the version of the server CLIENT is connected to."
757+
(let (jupyter-api-request-data
758+
jupyter-api-request-headers)
759+
;; This endpoint does not require authentication so it is OK to
760+
;; use `jupyter-api-http-request'.
761+
;;
762+
;; https://jupyter-server.readthedocs.io/en/latest/developers/rest-api.html#get--api-
763+
(plist-get
764+
(jupyter-api-http-request (oref client url) "api" "GET")
765+
:version)))
766+
755767
(cl-defgeneric jupyter-api/kernels (client method &rest plist)
756768
(declare (indent 2)))
757769

0 commit comments

Comments
 (0)