From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Wanted: volunteer to integrate REST-client (restclient.el) Date: Mon, 10 Feb 2014 10:59:09 -0500 Message-ID: References: <2014-02-07T14-30-02@devnull.Karl-Voit.at> <2014-02-10T14-07-33@devnull.Karl-Voit.at> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b6743ce8f284a04f20f6b72 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35316) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCtGL-000137-CG for emacs-orgmode@gnu.org; Mon, 10 Feb 2014 10:59:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCtGJ-0007og-U5 for emacs-orgmode@gnu.org; Mon, 10 Feb 2014 10:59:13 -0500 Received: from mail-pb0-x231.google.com ([2607:f8b0:400e:c01::231]:50149) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCtGJ-0007oT-Gm for emacs-orgmode@gnu.org; Mon, 10 Feb 2014 10:59:11 -0500 Received: by mail-pb0-f49.google.com with SMTP id up15so6346727pbc.8 for ; Mon, 10 Feb 2014 07:59:09 -0800 (PST) In-Reply-To: <2014-02-10T14-07-33@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" --047d7b6743ce8f284a04f20f6b72 Content-Type: text/plain; charset=ISO-8859-1 windows and pip/easy_install are funny sometimes. I often do something like this: #+BEGIN_SRC python from setuptools.command import easy_install easy_install.main( ["-U","requests"] ) #+END_SRC #+RESULTS: #+begin_example Searching for requests Reading http://pypi.python.org/simple/requests/ Best match: requests 2.2.1 Downloading https://pypi.python.org/packages/source/r/requests/requests-2.2.1.tar.gz#md5=ac27081135f58d1a43e4fb38258d6f4e Processing requests-2.2.1.tar.gz Writing /tmp/easy_install-EWppsP/requests-2.2.1/setup.cfg Running requests-2.2.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-EWppsP/requests-2.2.1/egg-dist-tmp-xoXvDk Adding requests 2.2.1 to easy-install.pth file Installed /opt/kitchingroup/enthought/epd-7.3-2-rh5-x86_64/lib/python2.7/site-packages/requests-2.2.1-py2.7.egg Processing dependencies for requests Finished processing dependencies for requests #+end_example 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 Mon, Feb 10, 2014 at 8:13 AM, Karl Voit wrote: > Hi John! > > * John Kitchin wrote: > > > > I think you could do this via requests directly. It could be done in > emacs: > > https://github.com/tkf/emacs-request > > Thanks for the pointer. > > I evaluated it and it seems not that good for my requirements > because I need it mainly for documenting stuff/issues/... > > With request.el, I need lots of lines per call whereas restclient.el > needs only three lines which can be written, read, adopted pretty > easily. > > > 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 > > This would be completely OK to me. > > Unfortunately, cygwin does not come with "python-requests" and I > failed at installing "pip" on my Windows machine [1] :-( > > > Probably restclient.el has also a unique feature which is neat for > my purpose: pretty printing XML responses. > > So I guess I have to stick with my current method which is using the > *scratch* buffer and manually switching to restclient-mode and > copy&paste the request and the results from/to my Org-mode buffers. > > However, thanks for the great links! > > 1. "python get-pip.py" runs without error message but then I can > not execute nor find pip(.exe) at all :-( > > -- > 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 > > > --047d7b6743ce8f284a04f20f6b72 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
windows and pip/easy_install are funny sometimes.
=
I often do something like this:

#+BEGIN_SRC python
from= setuptools.command import easy_install
easy_install.main( ["-U&quo= t;,"requests"] )
#+END_SRC

#+RESULTS:
#+begin_example
Searching for requestsReading http://pypi.py= thon.org/simple/requests/
Best match: requests 2.2.1
Downloading = https://pypi.python.org/pa= ckages/source/r/requests/requests-2.2.1.tar.gz#md5=3Dac27081135f58d1a43e4fb= 38258d6f4e
Processing requests-2.2.1.tar.gz
Writing /tmp/easy_install-EWppsP/reques= ts-2.2.1/setup.cfg
Running requests-2.2.1/setup.py -q bdist_egg --dist-d= ir /tmp/easy_install-EWppsP/requests-2.2.1/egg-dist-tmp-xoXvDk
Adding re= quests 2.2.1 to easy-install.pth file

Installed /opt/kitchingroup/enthought/epd-7.3-2-rh5-x86_64/lib/python2.= 7/site-packages/requests-2.2.1-py2.7.egg
Processing dependencies for req= uests
Finished processing dependencies for requests
#+end_example





John

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



On Mon, Feb 10, 2014 at 8:13 AM, Karl Vo= it <devnull@karl-voit.at> wrote:
Hi John!

* John Kitchin <jkitchin@andr= ew.cmu.edu> wrote:
>
> I think you could do this via requests directly. It could be done in e= macs:
> htt= ps://github.com/tkf/emacs-request

Thanks for the pointer.

I evaluated it and it seems not that good for my requirements
because I need it mainly for documenting stuff/issues/...

With request.el, I need lots of lines per call whereas restclient.el
needs only three lines which can be written, read, adopted pretty
easily.

> 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": "Basic YmVfcmVzdF9hZG1&qu= ot;,
> =A0 =A0 =A0 =A0 =A0 =A0"Accept-Encoding": "application/= xml"}
> r =3D requests.get("http://myserver/rest/dothis", headers=3Dheaders)
> print r.text
> #+END_SRC

This would be completely OK to me.

Unfortunately, cygwin does not come with "python-requests" and I<= br> failed at installing "pip" on my Windows machine [1] :-(


Probably restclient.el has also a unique feature which is neat for
my purpose: pretty printing XML responses.

So I guess I have to stick with my current method which is using the
*scratch* buffer and manually switching to restclient-mode and
copy&paste the request and the results from/to my Org-mode buffers.

However, thanks for the great links!

=A0 1. "python get-pip.py" runs without error message but then I = can
=A0 =A0 =A0not execute nor find pip(.exe) at all :-(

--
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



--047d7b6743ce8f284a04f20f6b72--