From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Wanted: volunteer to integrate REST-client (restclient.el) Date: Sat, 8 Feb 2014 19:18:31 -0500 Message-ID: References: <2014-02-07T14-30-02@devnull.Karl-Voit.at> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b2e0a75c240f604f1ee2947 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60023) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCI6U-0003k9-NG for emacs-orgmode@gnu.org; Sat, 08 Feb 2014 19:18:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCI6T-0007b5-9v for emacs-orgmode@gnu.org; Sat, 08 Feb 2014 19:18:34 -0500 Received: from mail-pb0-x233.google.com ([2607:f8b0:400e:c01::233]:44569) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCI6S-0007ax-Ui for emacs-orgmode@gnu.org; Sat, 08 Feb 2014 19:18:33 -0500 Received: by mail-pb0-f51.google.com with SMTP id un15so4751684pbc.24 for ; Sat, 08 Feb 2014 16:18:32 -0800 (PST) In-Reply-To: <2014-02-07T14-30-02@devnull.Karl-Voit.at> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: news1142@karl-voit.at Cc: "emacs-orgmode@gnu.org" --047d7b2e0a75c240f604f1ee2947 Content-Type: text/plain; charset=ISO-8859-1 I think you could do this via requests directly. It could be done in emacs: https://github.com/tkf/emacs-request or python: http://docs.python-requests.org/en/latest/ In your case you could have a block like this: #+BEGIN_SRC python import requests headers = {"Authorization": "Basic YmVfcmVzdF9hZG1", "Accept-Encoding": "application/xml"} r = requests.get("http://myserver/rest/dothis", headers=headers) print r.text #+END_SRC John ----------------------------------- John Kitchin Associate Professor Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 http://kitchingroup.cheme.cmu.edu On Fri, Feb 7, 2014 at 8:35 AM, Karl Voit wrote: > Hi! > > I am not an ELISP programmer (unfortunately) but a proud heavy-user > of Org-mode. At work, I need a REST-client to talk to a REST API > very often. > > Recently, I found [1] which works quite well. However, I need to > open a new buffer into restclient-mode to execute requests. > > Wouldn't it be nice if Org-mode could integrate this tool so that, > e.g., following example could be invoked via babel? > > #+BEGIN_SRC REST > GET http://myserver/rest/dothis > Authorization: Basic YmVfcmVzdF9hZG1 > Accept-Encoding: application/xml > #+END_SRC > > #+RESULTS: > : > : > : <...> > : > > I also proposed this as a request on [2] but the author is not using > Org-mode on a regular basis. > > So: is there any volunteer who wants to complete Org-mode's > featureset even more? > > Thanks! > > 1. https://github.com/pashky/restclient.el > 2. https://github.com/pashky/restclient.el/issues/21 > -- > mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode: > > get Memacs from https://github.com/novoid/Memacs < > > https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on > github > > > --047d7b2e0a75c240f604f1ee2947 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I think you could do this via requests= directly. It could be done in emacs: https://github.com/tkf/emacs-request

or python= : http://docs.python= -requests.org/en/latest/

In your case you could have a block like this:
#+BEGIN_SRC python
import requests
headers =3D {"Authorization&= quot;: "Basic YmVfcmVzdF9hZG1",
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= "Accept-Encoding": "application/xml"}
r =3D requests.get("http://mys= erver/rest/dothis", headers=3Dheaders)
print r.text
#+END_SR= C


John
-----------------------------------
John Kitchin
Associate Professor
Doherty Hall A207F
Department of = Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213<= br>412-268-7803
http://kitchingroup.cheme.cmu.edu



On Fri, Feb 7, 2014 at 8:35 AM, Karl Voi= t <devnull@karl-voit.at> wrote:
Hi!

I am not an ELISP programmer (unfortunately) but a proud heavy-user
of Org-mode. At work, I need a REST-client to talk to a REST API
very often.

Recently, I found [1] which works quite well. However, I need to
open a new buffer into restclient-mode to execute requests.

Wouldn't it be nice if Org-mode could integrate this tool so that,
e.g., following example could be invoked via babel?

=A0 =A0 #+BEGIN_SRC REST
=A0 =A0 GET http:= //myserver/rest/dothis
=A0 =A0 Authorization: Basic YmVfcmVzdF9hZG1
=A0 =A0 Accept-Encoding: application/xml
=A0 =A0 #+END_SRC

=A0 =A0 #+RESULTS:
=A0 =A0 : <?xml version=3D"1.0" encoding=3D"UTF-8" s= tandalone=3D"yes"?>
=A0 =A0 : <faultInfo xmlns=3D"http://example.com/product/model"> =A0 =A0 : =A0 <...>
=A0 =A0 : </faultInfo>

I also proposed this as a request on [2] but the author is not using
Org-mode on a regular basis.

So: is there any volunteer who wants to complete Org-mode's
featureset even more?

Thanks!

=A0 1. https://github.com/pashky/restclient.el
=A0 2. https://github.com/pashky/restclient.el/issues/21
--
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
=A0 =A0 =A0 =A0> get Memacs from https://github.com/novoid/Memacs <

https://github.com/novoid/extract_pdf_annotations_to_orgmod= e + more on github



--047d7b2e0a75c240f604f1ee2947--