Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
HTTP request lib for Emacs built on curl with flexible callback dispatch
Emacs Lisp

Version 0.5.3

latest commit 7387234eb3
David Leatherman authored

readme.org

grapnel

A HTTP request lib for Emacs with flexible callback dispatch.

grapnel is an HTTP request library that uses a curl subprocess and offers flexible callback dispatch. Not only can you pass in an alist of request outcomes to callback functions (see below) but you can also override the dispatch function itself if the default one doesn’t suit your needs. Further, grapnel will build the query string, request data (i.e., POST body), and headers from alists that are passed in.

See the inline docs for more information.

Installation

Via Marmalade/Melpa

(require 'package)
(add-to-list 'package-archives
             '("marmalade" . "http://marmalade-repo.org/packages/") t)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)

Then you can install it:

M-x package-refresh-contents
M-x package-install RET grapnel RET

Manually (via git)

Download the source or clone the repo and add the following to ~/.emacs.d/init.el:

(add-to-list 'load-path "path/to/grapnel")
(require 'grapnel)

Usage Example

(grapnel-retrieve-url
   url
   `((401 . (lambda (response headers)
              (error "Unauthorized!")))
     (success . ,success-callback)
     (failure . (lambda (response headers)
                  (error "Failed with: %s for %s"
                         (cadr (assoc "response-code" headers))
                         ,url)))
     (error . (lambda (response)
                (error "Error: %s" response))))
   "GET"
   '((some-param . "some-value")))

License

Copyright © 2013 David Leatherman.

Files are licensed under the same license as Emacs unless otherwise specified. See the file LICENSE for details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Something went wrong with that request. Please try again.