emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Wanted: volunteer to integrate REST-client (restclient.el)
@ 2014-02-07 13:35 Karl Voit
  2014-02-09  0:18 ` John Kitchin
  0 siblings, 1 reply; 7+ messages in thread
From: Karl Voit @ 2014-02-07 13:35 UTC (permalink / raw)
  To: emacs-orgmode

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:
    : <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    : <faultInfo xmlns="http://example.com/product/model">
    :   <...>
    : </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!
   
  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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Wanted: volunteer to integrate REST-client (restclient.el)
  2014-02-07 13:35 Wanted: volunteer to integrate REST-client (restclient.el) Karl Voit
@ 2014-02-09  0:18 ` John Kitchin
  2014-02-10 13:13   ` Karl Voit
  0 siblings, 1 reply; 7+ messages in thread
From: John Kitchin @ 2014-02-09  0:18 UTC (permalink / raw)
  To: news1142; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 2039 bytes --]

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 <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?
>
>     #+BEGIN_SRC REST
>     GET http://myserver/rest/dothis
>     Authorization: Basic YmVfcmVzdF9hZG1
>     Accept-Encoding: application/xml
>     #+END_SRC
>
>     #+RESULTS:
>     : <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>     : <faultInfo xmlns="http://example.com/product/model">
>     :   <...>
>     : </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!
>
>   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
>
>
>

[-- Attachment #2: Type: text/html, Size: 3453 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Wanted: volunteer to integrate REST-client (restclient.el)
  2014-02-09  0:18 ` John Kitchin
@ 2014-02-10 13:13   ` Karl Voit
  2014-02-10 15:59     ` John Kitchin
  0 siblings, 1 reply; 7+ messages in thread
From: Karl Voit @ 2014-02-10 13:13 UTC (permalink / raw)
  To: emacs-orgmode

Hi John!

* John Kitchin <jkitchin@andrew.cmu.edu> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Wanted: volunteer to integrate REST-client (restclient.el)
  2014-02-10 13:13   ` Karl Voit
@ 2014-02-10 15:59     ` John Kitchin
  2014-02-12 15:02       ` OT: installing pip on Windows/Cygwin (was: Wanted: volunteer to integrate REST-client (restclient.el)) Karl Voit
  0 siblings, 1 reply; 7+ messages in thread
From: John Kitchin @ 2014-02-10 15:59 UTC (permalink / raw)
  To: news1142; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 2965 bytes --]

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 <devnull@karl-voit.at> wrote:

> Hi John!
>
> * John Kitchin <jkitchin@andrew.cmu.edu> 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
>
>
>

[-- Attachment #2: Type: text/html, Size: 4529 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* OT: installing pip on Windows/Cygwin (was: Wanted: volunteer to integrate REST-client (restclient.el))
  2014-02-10 15:59     ` John Kitchin
@ 2014-02-12 15:02       ` Karl Voit
  2014-02-12 16:12         ` Karl Voit
  2014-02-12 17:08         ` John Kitchin
  0 siblings, 2 replies; 7+ messages in thread
From: Karl Voit @ 2014-02-12 15:02 UTC (permalink / raw)
  To: emacs-orgmode

Hi John!

* John Kitchin <jkitchin@andrew.cmu.edu> wrote:
>
> 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

Ah, great idea. However, at my side, it ends up like this:

#+BEGIN_SRC python :results output
from setuptools.command import easy_install
easy_install.main( ["-U","requests"] )
#+END_SRC

#+RESULTS:
: 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 /cygdrive/c/Users/KARL~1.VOI/AppData/Local/Temp/easy_install-L3Xxcz/requests-2.2.1/setup.cfg
: Running requests-2.2.1/setup.py -q bdist_egg --dist-dir /cygdrive/c/Users/KARL~1.VOI/AppData/Local/Temp/easy_install-L3Xxcz/requests-2.2.1/egg-dist-tmp-veH5jq

In Cygwin shell, I can execute "easy_install pip". After that, I can execute
"pip" but I never get any output on "pip help" "pip -h" "pip --help" or "pip
install requests".

I miss my Linux at work :-(

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: OT: installing pip on Windows/Cygwin (was: Wanted: volunteer to integrate REST-client (restclient.el))
  2014-02-12 15:02       ` OT: installing pip on Windows/Cygwin (was: Wanted: volunteer to integrate REST-client (restclient.el)) Karl Voit
@ 2014-02-12 16:12         ` Karl Voit
  2014-02-12 17:08         ` John Kitchin
  1 sibling, 0 replies; 7+ messages in thread
From: Karl Voit @ 2014-02-12 16:12 UTC (permalink / raw)
  To: emacs-orgmode

* Karl Voit <devnull@Karl-Voit.at> wrote:
>
> * John Kitchin <jkitchin@andrew.cmu.edu> wrote:
>>
>> windows and pip/easy_install are funny sometimes.
>>
>> I often do something like this:
>
> Ah, great idea. However, at my side, it ends up like this:
>
[...]
>
> In Cygwin shell, I can execute "easy_install pip". After that, I can execute
> "pip" but I never get any output on "pip help" "pip -h" "pip --help" or "pip
> install requests".

Addendum: I don't expect you to fix my issue here - I just wanted to
report that this external dependency (python and the
requests-library) is something which can not be solved on all
systems obviously (and sadly).

So far, for my use-case I am very happy with the restclient.el. From
a convenience point of view it would be perfect when I would be able
to call it via babel. But this is whining on a high level :-)

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: OT: installing pip on Windows/Cygwin (was: Wanted: volunteer to integrate REST-client (restclient.el))
  2014-02-12 15:02       ` OT: installing pip on Windows/Cygwin (was: Wanted: volunteer to integrate REST-client (restclient.el)) Karl Voit
  2014-02-12 16:12         ` Karl Voit
@ 2014-02-12 17:08         ` John Kitchin
  1 sibling, 0 replies; 7+ messages in thread
From: John Kitchin @ 2014-02-12 17:08 UTC (permalink / raw)
  To: news1142; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 3300 bytes --]

I don't understand, it looks like this worked.

#+RESULTS:
: 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
/cygdrive/c/Users/KARL~1.VOI/AppData/Local/Temp/easy_install-L3Xxcz/requests-2.2.1/setup.cfg
: Running requests-2.2.1/setup.py -q bdist_egg --dist-dir
/cygdrive/c/Users/KARL~1.VOI/AppData/Local/Temp/easy_install-L3Xxcz/requests-2.2.1/egg-dist-tmp-veH5jq

After this, are you unable to import requests?

I don't use cygwin, and maybe the funny drive paths confuse windows.

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 Wed, Feb 12, 2014 at 10:02 AM, Karl Voit <devnull@karl-voit.at> wrote:

> Hi John!
>
> * John Kitchin <jkitchin@andrew.cmu.edu> wrote:
> >
> > 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
>
> Ah, great idea. However, at my side, it ends up like this:
>
> #+BEGIN_SRC python :results output
> from setuptools.command import easy_install
> easy_install.main( ["-U","requests"] )
> #+END_SRC
>
> #+RESULTS:
> : 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
> /cygdrive/c/Users/KARL~1.VOI/AppData/Local/Temp/easy_install-L3Xxcz/requests-2.2.1/setup.cfg
> : Running requests-2.2.1/setup.py -q bdist_egg --dist-dir
> /cygdrive/c/Users/KARL~1.VOI/AppData/Local/Temp/easy_install-L3Xxcz/requests-2.2.1/egg-dist-tmp-veH5jq
>
> In Cygwin shell, I can execute "easy_install pip". After that, I can
> execute
> "pip" but I never get any output on "pip help" "pip -h" "pip --help" or
> "pip
> install requests".
>
> I miss my Linux at work :-(
>
> --
> 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
>
>
>

[-- Attachment #2: Type: text/html, Size: 5085 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-02-12 17:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-07 13:35 Wanted: volunteer to integrate REST-client (restclient.el) Karl Voit
2014-02-09  0:18 ` John Kitchin
2014-02-10 13:13   ` Karl Voit
2014-02-10 15:59     ` John Kitchin
2014-02-12 15:02       ` OT: installing pip on Windows/Cygwin (was: Wanted: volunteer to integrate REST-client (restclient.el)) Karl Voit
2014-02-12 16:12         ` Karl Voit
2014-02-12 17:08         ` John Kitchin

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).