/fetch.el

A simple HTTP request library modeled after the web browser API

Primary LanguageEmacs Lisp

fetch.el

Goals

  • Simple, discoverable API
  • Reduce boilerplate

Installing

Using Straight.el

(straight-use-package
 '(fetch :type git :host github :repo "ebpa/fetch.el" :files ("*.el")))

Usage

Basic synchronous usage

(fetch "https://www.gnu.org/software/emacs")

Asynchronous (callback)

(fetch "https://www.gnu.org/software/emacs"
  :callback (lambda (response)
              (message "The response status code is %d" (fetch-response-status-code response))))

Asynchronous (promise.el)

(promise-chain
    (fetch "https://www.gnu.org/software/emacs" :promise t)
  (then #'fetch-html)
  (then (lambda (html)
          (message "%s" html))))

Alternatives / Related Projects