grapnel - HTTP request for Emacs lib built on curl 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.
Coming soon. I’m still testing it out, but it has proven pretty reliable so far.
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)
(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")))
Source Copyright © 2012 David Leatherman. Distributed under the GNU General Public License version 3.