[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A (probably silly) problem with request.el
From: |
John Mastro |
Subject: |
Re: A (probably silly) problem with request.el |
Date: |
Wed, 10 Jun 2015 15:15:43 -0700 |
Marcin Borkowski <mbork@mbork.pl> wrote:
> OK, so I have now another (though related) problem. What I want is to
> write a function which will accept the url, feed it to =request=, and
> /return/ the json-translated-to-sexp result. I tried this:
>
> (require 'request-deferred)
>
> (deferred:$
> (request-deferred "http://httpbin.org/get" :parser 'json-read)
> (deferred:nextc it
> (lambda (response)
> (request-response-data response))))
>
> (slightly modified from http://tkf.github.io/emacs-request/manual.html),
> but it didn't seem to work. (It just returns the struct, not the sexp.)
> Unfortunately, I do not really understand request's (nor deferred's)
> docs well enough to be able to debug it myself. Any hints?
Try this:
(defun my-request-get (url &optional params)
(request-response-data (request
url
:params params
:parser #'json-read
:sync t)))
If you essentially don't want the request to be asyncronous, then I
think `:sync t' is the way to go.
--
john
- A (probably silly) problem with request.el, Marcin Borkowski, 2015/06/04
- Re: A (probably silly) problem with request.el, Nicolas Richard, 2015/06/05
- Re: A (probably silly) problem with request.el, Marcin Borkowski, 2015/06/05
- Re: A (probably silly) problem with request.el, Nicolas Richard, 2015/06/05
- Re: A (probably silly) problem with request.el, Marcin Borkowski, 2015/06/05
- Re: A (probably silly) problem with request.el, Nicolas Richard, 2015/06/06
- Re: A (probably silly) problem with request.el, Marcin Borkowski, 2015/06/06
- Re: A (probably silly) problem with request.el, Marcin Borkowski, 2015/06/06
- Re: A (probably silly) problem with request.el, Nicolas Richard, 2015/06/08
- Re: A (probably silly) problem with request.el, Marcin Borkowski, 2015/06/10
- Re: A (probably silly) problem with request.el,
John Mastro <=