Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
HTTP request lib for Emacs built on curl with flexible callback dispatch
Emacs Lisp
Pull request Compare This branch is 20 commits behind master.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
grapnel.el
readme.org

readme.org

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.

Installation

Via Marmalade

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)

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

Source Copyright © 2012 David Leatherman. Distributed under the GNU General Public License version 3.

Something went wrong with that request. Please try again.