From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: John Mastro Newsgroups: gmane.emacs.help Subject: Re: A (probably silly) problem with request.el Date: Wed, 10 Jun 2015 15:15:43 -0700 Message-ID: References: <87bngv89g5.fsf@mbork.pl> <87h9qmsbyn.fsf@members.fsf.org> <87fv668d9f.fsf@mbork.pl> <5571C2EC.90903@members.fsf.org> <87y4jx7so5.fsf@mbork.pl> <878ubwskor.fsf@members.fsf.org> <87r3pjmdjr.fsf@mbork.pl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1433974586 3437 80.91.229.3 (10 Jun 2015 22:16:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 10 Jun 2015 22:16:26 +0000 (UTC) To: Marcin Borkowski , Help Gnu Emacs mailing list Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jun 11 00:16:20 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z2oIF-0007YM-KU for geh-help-gnu-emacs@m.gmane.org; Thu, 11 Jun 2015 00:16:19 +0200 Original-Received: from localhost ([::1]:42522 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z2oIE-000694-GY for geh-help-gnu-emacs@m.gmane.org; Wed, 10 Jun 2015 18:16:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36115) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z2oI2-00068x-PI for help-gnu-emacs@gnu.org; Wed, 10 Jun 2015 18:16:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z2oI1-0003FW-Oh for help-gnu-emacs@gnu.org; Wed, 10 Jun 2015 18:16:06 -0400 Original-Received: from mail-ob0-x243.google.com ([2607:f8b0:4003:c01::243]:35585) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z2oI1-00039f-2I for help-gnu-emacs@gnu.org; Wed, 10 Jun 2015 18:16:05 -0400 Original-Received: by obbnt9 with SMTP id nt9so6568755obb.2 for ; Wed, 10 Jun 2015 15:16:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=9v4XjilVEgEGAN9DjvQjxXhwJQEN/ac0NSLhXW4Qp/Y=; b=ZT3c1MByuFl84C2fsAavCPdFu33gfJYU6p0TXCkev4/W7/VgWazmMdJ6bCjdTUSclC PGkREqzYVZgWc3gGlmp+ECFJQ+y1keVZOlyLktkT0aLqUew7XaeXskVyy4MLJG+/CwXU 8v01BrGlqG5It/cTHlszgueHE56xO8mTtUZp+097FenQEQtZkAAW3mChjFaUyKaJUbRe +c6zERFyQ1XGdf3adGu2UJGEqPYsrGsMl8+ezscCFobbhBjiXbIBRqgYBlaI6XM4WWds s62Yi+nT1uffRKNWl6VDZqeNgVXMGy4T8mgx9uhy9JImbgv2H2ID0mElg/YK4SiTvDd3 cxuw== X-Received: by 10.60.37.166 with SMTP id z6mr4718719oej.63.1433974564234; Wed, 10 Jun 2015 15:16:04 -0700 (PDT) Original-Received: by 10.76.168.70 with HTTP; Wed, 10 Jun 2015 15:15:43 -0700 (PDT) In-Reply-To: <87r3pjmdjr.fsf@mbork.pl> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c01::243 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:104883 Archived-At: Marcin Borkowski 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