使用 plz.el / plz-see 一步请求

1
2
3
4
5
6
7
8
(let* ((result (plz 'get "http://localhost:18399/is_alive"
                 :as #'json-read
                 :then (lambda (alist) (let* ((data (gethash "data" alist))
                                              (time (gethash "time" data)))
                                         (message "time: %s" time))
                         ))
               ))  result)
#<process plz-request-curl>

使用 request.el

1
2
3
4
❯ curl -X 'GET' \
  'http://172.16.10.67:18399/is_alive' \
  -H 'accept: application/json'
{"code":200,"msg":"ok","data":{"time":"2025-07-24T17:09:12.963398"}}%
1
2
3
4
5
6
7
ELISP> (let* ((resp-data (request-response-data (request "http://localhost:18399/is_alive"
                                                  :type "GET"
                                                  :parser 'json-read
                                                  :sync t)))
              (data (gethash "data" resp-data)) (time (gethash "time" data))) time)

"2025-07-24T16:55:46.890293"