Appveyor iterating (WIP) (#573)
* ob-ein: Bring back old functionality.
Bring back some old features to babel edit buffers while trying to respect
recent addition of polymode support.
* Override polymode if the user really wants.
Polymode is really for notebook buffers in any case, but this will override
whatever completion backmode a user has configured for python-mode.
* Install cask using python2.
For now python2 is the easiest option for testing on Windows since cask does
not properly support python3 when in Windows.
* Let's throw in the ert-runner, see what happens.
* Can I use my fork of cask?
Work around smartrep weirdness, try to live without command line wildcard
expansion.
* Get the url for the fork right.
* Experiment with python37, use test_script.
* Unstick appveyor, I hope.
* Fix parsing error.
* test_script is not executing. Why?
* Add ert testing.
But why are the test_script commands not executing?
* tasks: Automate building and testing using invoke.
Invoke leverages Python, which I hope will allow us to abstract out differences
in platforms when it comes to building and testing ein.
* Use invoke on appveyor.
* appveyor: Use the environment python.
So we can test versions other than python 2.7.
* Parsing error.
Is
https://packaging.python.org/guides/supporting-windows-using-appveyor/#setting-up
lying to me?
* Quote commands, just in case.
* Get python onto the path.
* Appveyor is catching up to travis.
* Parsing error.
* Update pip, try to get quoted syntax right.
* Still not liking my pip call.
Last try, next step we go to a requirements.txt file.
* Go to using a requirements file for pip.
* ecukes needs bash to work.
* Cleaning up and fiddling.
Seems like the emacs-jupyter guy has his act together - maybe we can take some
inspiration for our appveyor config.
* Syntax error in environment.
* More syntax errros.
* Maybe we need quoting.
* I give up.
* Formatting and cleanup.
* Add customization, yet another syntax error.
New customizable variable `ob-ein-babel-edit-polymode-ignore' to override
keybinding for \C-c\C-c in an org source code edit buffer.
* John learned some Powershell today.
* Fix the executable path.
Sometimes there is more than one curl installed on the system, make sure we can
account for that in testing.
* Handle updating the path inside invoke.
* Report which curl we are using before starting functional tests.
* Enable RDP so we can see error logs.
* Keep the build alive even when it finishes.
* Fix #568.
Apparently we need to specify the user agent when on windows, otherwise tornado
will start throwing 403 responses. Currently using Mozilla/4.0 as the agent, but
might be a good idea to make this value customizable.
* Clean up emacs config.
* Why is appveyor dropping the xsrf token?
* xsrf cookie found, what does the header look like?
* Try different user-agent header, reenable rdp.
* JSON encoding issues on Python side, it appears. Let's try an older Python.
Login works, contents query to get notebooklist works (i.e. GET on
/contents/api), but creating a notebook (i.e. POST on /contents/api) fails with
invalid JSON. ein and emacs-request appear to be generating the proper json, but
jupyter notebook does not see the same thing that is being written. Could be
bytes vs. text issue with modern v3.x python, so let us see how this all works
with Python 2.7.
* Python27 does not have pathlib out of the box.
* Make amends with Python27
* Back to python37.
Tornado/notebook still isn't reading the POST'ed json correctly.
* Do we need to specify content type?
* Must be selective in specifying application/json content.
* Re-enable rdp.
* Let's try a different curl.
* Ensure most recent curl is on path
* Try a different path.
* Try to warn user if suspicious curl detected.
* Remove debugging statements.
* EVM depends on trusty for 26.x
See issue #125 (https://github.com/rejeep/evm/issues/125). Let's hope I got the
travis.yml syntax right.
* Minimal support for ecukes from invoke.
* Cleaner server shutdowns, better ecukes support from invoke.
Use the /api/shutdown REST API call now to shutdown running server. Also support
more command line options for ecukes from invoke.
* Almost full support of ecukes using invoke.
But! Also disabling integration testing for the time being until I understand
why ecukes fails even though everything else is working.
* Just do integration and functional testing on appveyor.
Better than nothing while I work out what is breaking the integration tests.
2019-07-28 18:20:13 -06:00
;;; ein-query.el --- jQuery like interface on to of url-retrieve -*- lexical-binding: t -*-
2012-05-25 20:57:48 +02:00
;; Copyright (C) 2012- Takafumi Arakaki
2012-07-01 20:18:05 +02:00
;; Author: Takafumi Arakaki <aka.tkf at gmail.com>
2012-05-25 20:57:48 +02:00
;; This file is NOT part of GNU Emacs.
;; ein-query.el is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; ein-query.el is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with ein-query.el. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;;; Code:
( eval-when-compile ( require 'cl ) )
2018-11-09 14:50:16 -05:00
( require 'request )
2014-05-23 15:24:48 -04:00
( require 'url )
2012-05-25 20:57:48 +02:00
2012-08-28 15:26:32 +02:00
( require 'ein-core )
2012-05-25 20:57:48 +02:00
( require 'ein-log )
2012-06-08 13:54:39 +02:00
;;; Utils
2012-05-25 20:57:48 +02:00
( defun ein:safe-funcall-packed ( packed &rest args )
( when packed
( ein:log-ignore-errors ( apply #' ein:funcall-packed packed args ) ) ) )
2012-06-08 13:54:39 +02:00
;;; Variables
2012-05-27 01:58:39 +02:00
2013-06-11 16:49:49 +02:00
( defcustom ein:query-timeout
( if ( eq request-backend 'url-retrieve ) 1000 nil )
2012-06-21 00:38:15 +02:00
" Default query timeout for HTTP access in millisecond.
Setting this to ` nil ' means no timeout.
2013-06-11 16:49:49 +02:00
If you have ` ` curl ` ` command line program, it is automatically set to
` nil ' as ` ` curl ` ` is reliable than ` url-retrieve ' therefore no need for
a workaround ( see below ) .
2012-06-21 00:38:15 +02:00
If you do the same operation before the timeout, old operation
2018-10-24 13:12:16 -04:00
will NO LONGER be canceled ( as it the cookie jar gets clobbered when curl
aborts ) . Instead you will see Race! in debug messages.
2012-06-21 00:38:15 +02:00
. . note:: This value exists because it looks like ` url-retrieve '
2012-06-21 15:03:41 +02:00
occasionally fails to finish \(start? ) querying. Timeout is
used to let user notice that their operation is not finished.
It also prevent opening a lot of useless process buffers.
You will see them when closing Emacs if there is no timeout.
2012-06-21 00:38:15 +02:00
2012-06-21 15:03:41 +02:00
If you know how to fix the problem with ` url-retrieve ', please
let me know or send pull request at github!
2012-06-21 00:38:15 +02:00
\(Related bug report in Emacs bug tracker:
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11469 ) "
2012-05-27 01:58:39 +02:00
:type ' ( choice ( integer :tag " Timeout [ms] " 5000 )
( const :tag " No timeout " nil ) )
:group 'ein )
2012-06-08 13:54:39 +02:00
;;; Functions
2012-06-20 20:56:04 +02:00
( defvar ein:query-running-process-table ( make-hash-table :test 'equal ) )
2018-12-05 17:15:02 -05:00
( defvar ein:query-xsrf-cache ( make-hash-table :test 'equal )
" Hack: remember the last xsrf token by host in case we catch cookie jar in transition. The proper fix is to sempahore between competing curl processes. " )
2017-01-03 20:11:28 -06:00
( defun ein:query-prepare-header ( url settings &optional securep )
2018-12-01 18:54:58 -05:00
" Ensure that REST calls to the jupyter server have the correct _xsrf argument. "
2018-12-05 17:15:02 -05:00
( let* ( ( host ( url-host ( url-generic-parse-url url ) ) )
( cookies ( request-cookie-alist host " / " securep ) )
( xsrf ( or ( cdr ( assoc-string " _xsrf " cookies ) )
( gethash host ein:query-xsrf-cache ) ) ) )
Appveyor iterating (WIP) (#573)
* ob-ein: Bring back old functionality.
Bring back some old features to babel edit buffers while trying to respect
recent addition of polymode support.
* Override polymode if the user really wants.
Polymode is really for notebook buffers in any case, but this will override
whatever completion backmode a user has configured for python-mode.
* Install cask using python2.
For now python2 is the easiest option for testing on Windows since cask does
not properly support python3 when in Windows.
* Let's throw in the ert-runner, see what happens.
* Can I use my fork of cask?
Work around smartrep weirdness, try to live without command line wildcard
expansion.
* Get the url for the fork right.
* Experiment with python37, use test_script.
* Unstick appveyor, I hope.
* Fix parsing error.
* test_script is not executing. Why?
* Add ert testing.
But why are the test_script commands not executing?
* tasks: Automate building and testing using invoke.
Invoke leverages Python, which I hope will allow us to abstract out differences
in platforms when it comes to building and testing ein.
* Use invoke on appveyor.
* appveyor: Use the environment python.
So we can test versions other than python 2.7.
* Parsing error.
Is
https://packaging.python.org/guides/supporting-windows-using-appveyor/#setting-up
lying to me?
* Quote commands, just in case.
* Get python onto the path.
* Appveyor is catching up to travis.
* Parsing error.
* Update pip, try to get quoted syntax right.
* Still not liking my pip call.
Last try, next step we go to a requirements.txt file.
* Go to using a requirements file for pip.
* ecukes needs bash to work.
* Cleaning up and fiddling.
Seems like the emacs-jupyter guy has his act together - maybe we can take some
inspiration for our appveyor config.
* Syntax error in environment.
* More syntax errros.
* Maybe we need quoting.
* I give up.
* Formatting and cleanup.
* Add customization, yet another syntax error.
New customizable variable `ob-ein-babel-edit-polymode-ignore' to override
keybinding for \C-c\C-c in an org source code edit buffer.
* John learned some Powershell today.
* Fix the executable path.
Sometimes there is more than one curl installed on the system, make sure we can
account for that in testing.
* Handle updating the path inside invoke.
* Report which curl we are using before starting functional tests.
* Enable RDP so we can see error logs.
* Keep the build alive even when it finishes.
* Fix #568.
Apparently we need to specify the user agent when on windows, otherwise tornado
will start throwing 403 responses. Currently using Mozilla/4.0 as the agent, but
might be a good idea to make this value customizable.
* Clean up emacs config.
* Why is appveyor dropping the xsrf token?
* xsrf cookie found, what does the header look like?
* Try different user-agent header, reenable rdp.
* JSON encoding issues on Python side, it appears. Let's try an older Python.
Login works, contents query to get notebooklist works (i.e. GET on
/contents/api), but creating a notebook (i.e. POST on /contents/api) fails with
invalid JSON. ein and emacs-request appear to be generating the proper json, but
jupyter notebook does not see the same thing that is being written. Could be
bytes vs. text issue with modern v3.x python, so let us see how this all works
with Python 2.7.
* Python27 does not have pathlib out of the box.
* Make amends with Python27
* Back to python37.
Tornado/notebook still isn't reading the POST'ed json correctly.
* Do we need to specify content type?
* Must be selective in specifying application/json content.
* Re-enable rdp.
* Let's try a different curl.
* Ensure most recent curl is on path
* Try a different path.
* Try to warn user if suspicious curl detected.
* Remove debugging statements.
* EVM depends on trusty for 26.x
See issue #125 (https://github.com/rejeep/evm/issues/125). Let's hope I got the
travis.yml syntax right.
* Minimal support for ecukes from invoke.
* Cleaner server shutdowns, better ecukes support from invoke.
Use the /api/shutdown REST API call now to shutdown running server. Also support
more command line options for ecukes from invoke.
* Almost full support of ecukes using invoke.
But! Also disabling integration testing for the time being until I understand
why ecukes fails even though everything else is working.
* Just do integration and functional testing on appveyor.
Better than nothing while I work out what is breaking the integration tests.
2019-07-28 18:20:13 -06:00
( ein:log 'debug " EIN:QUERY-PREPARE-HEADER: Found xsrf: %s " xsrf )
( setq settings ( plist-put settings :headers
( append ( plist-get settings :headers )
( list ( cons " User-Agent " " Mozilla/5.0 " ) ) ) ) )
2018-12-05 17:15:02 -05:00
( when xsrf
( setq settings ( plist-put settings :headers
( append ( plist-get settings :headers )
( list ( cons " X-XSRFTOKEN " xsrf ) ) ) ) )
( setf ( gethash host ein:query-xsrf-cache ) xsrf ) )
2019-07-02 00:04:06 -04:00
( setq settings ( plist-put settings :encoding 'binary ) )
2017-07-25 15:36:07 -05:00
settings ) )
2017-01-03 20:11:28 -06:00
2018-10-12 14:03:22 -05:00
( defcustom ein:max-simultaneous-queries 100
2018-10-12 11:34:44 -05:00
" Limit number of simultaneous queries to Jupyter server.
If too many calls to ` request ' are made at once Emacs may
complaint and raise a 'Too Many Files ' exception. By setting this
variable to a reasonable value you can avoid this situation. "
:group 'ein
:type 'integer )
Appveyor iterating (WIP) (#573)
* ob-ein: Bring back old functionality.
Bring back some old features to babel edit buffers while trying to respect
recent addition of polymode support.
* Override polymode if the user really wants.
Polymode is really for notebook buffers in any case, but this will override
whatever completion backmode a user has configured for python-mode.
* Install cask using python2.
For now python2 is the easiest option for testing on Windows since cask does
not properly support python3 when in Windows.
* Let's throw in the ert-runner, see what happens.
* Can I use my fork of cask?
Work around smartrep weirdness, try to live without command line wildcard
expansion.
* Get the url for the fork right.
* Experiment with python37, use test_script.
* Unstick appveyor, I hope.
* Fix parsing error.
* test_script is not executing. Why?
* Add ert testing.
But why are the test_script commands not executing?
* tasks: Automate building and testing using invoke.
Invoke leverages Python, which I hope will allow us to abstract out differences
in platforms when it comes to building and testing ein.
* Use invoke on appveyor.
* appveyor: Use the environment python.
So we can test versions other than python 2.7.
* Parsing error.
Is
https://packaging.python.org/guides/supporting-windows-using-appveyor/#setting-up
lying to me?
* Quote commands, just in case.
* Get python onto the path.
* Appveyor is catching up to travis.
* Parsing error.
* Update pip, try to get quoted syntax right.
* Still not liking my pip call.
Last try, next step we go to a requirements.txt file.
* Go to using a requirements file for pip.
* ecukes needs bash to work.
* Cleaning up and fiddling.
Seems like the emacs-jupyter guy has his act together - maybe we can take some
inspiration for our appveyor config.
* Syntax error in environment.
* More syntax errros.
* Maybe we need quoting.
* I give up.
* Formatting and cleanup.
* Add customization, yet another syntax error.
New customizable variable `ob-ein-babel-edit-polymode-ignore' to override
keybinding for \C-c\C-c in an org source code edit buffer.
* John learned some Powershell today.
* Fix the executable path.
Sometimes there is more than one curl installed on the system, make sure we can
account for that in testing.
* Handle updating the path inside invoke.
* Report which curl we are using before starting functional tests.
* Enable RDP so we can see error logs.
* Keep the build alive even when it finishes.
* Fix #568.
Apparently we need to specify the user agent when on windows, otherwise tornado
will start throwing 403 responses. Currently using Mozilla/4.0 as the agent, but
might be a good idea to make this value customizable.
* Clean up emacs config.
* Why is appveyor dropping the xsrf token?
* xsrf cookie found, what does the header look like?
* Try different user-agent header, reenable rdp.
* JSON encoding issues on Python side, it appears. Let's try an older Python.
Login works, contents query to get notebooklist works (i.e. GET on
/contents/api), but creating a notebook (i.e. POST on /contents/api) fails with
invalid JSON. ein and emacs-request appear to be generating the proper json, but
jupyter notebook does not see the same thing that is being written. Could be
bytes vs. text issue with modern v3.x python, so let us see how this all works
with Python 2.7.
* Python27 does not have pathlib out of the box.
* Make amends with Python27
* Back to python37.
Tornado/notebook still isn't reading the POST'ed json correctly.
* Do we need to specify content type?
* Must be selective in specifying application/json content.
* Re-enable rdp.
* Let's try a different curl.
* Ensure most recent curl is on path
* Try a different path.
* Try to warn user if suspicious curl detected.
* Remove debugging statements.
* EVM depends on trusty for 26.x
See issue #125 (https://github.com/rejeep/evm/issues/125). Let's hope I got the
travis.yml syntax right.
* Minimal support for ecukes from invoke.
* Cleaner server shutdowns, better ecukes support from invoke.
Use the /api/shutdown REST API call now to shutdown running server. Also support
more command line options for ecukes from invoke.
* Almost full support of ecukes using invoke.
But! Also disabling integration testing for the time being until I understand
why ecukes fails even though everything else is working.
* Just do integration and functional testing on appveyor.
Better than nothing while I work out what is breaking the integration tests.
2019-07-28 18:20:13 -06:00
( let ( ( checked-curl-version nil ) )
( defun ein:warn-on-curl-version ( )
( let ( ( curl ( executable-find request-curl ) ) )
( unless checked-curl-version
( setq checked-curl-version t )
( with-temp-buffer
( call-process curl nil t nil " --version " )
( goto-char ( point-min ) )
( when ( search-forward " mingw32 " nil t )
( warn " The current version of curl (%s) may not work with ein. We recommend you install the latest, official version from the curl website: https://curl.haxx.se " ( buffer-string ) ) ) ) ) ) ) )
2018-11-09 14:50:16 -05:00
( defsubst ein:query-enforce-curl ( )
Appveyor iterating (WIP) (#573)
* ob-ein: Bring back old functionality.
Bring back some old features to babel edit buffers while trying to respect
recent addition of polymode support.
* Override polymode if the user really wants.
Polymode is really for notebook buffers in any case, but this will override
whatever completion backmode a user has configured for python-mode.
* Install cask using python2.
For now python2 is the easiest option for testing on Windows since cask does
not properly support python3 when in Windows.
* Let's throw in the ert-runner, see what happens.
* Can I use my fork of cask?
Work around smartrep weirdness, try to live without command line wildcard
expansion.
* Get the url for the fork right.
* Experiment with python37, use test_script.
* Unstick appveyor, I hope.
* Fix parsing error.
* test_script is not executing. Why?
* Add ert testing.
But why are the test_script commands not executing?
* tasks: Automate building and testing using invoke.
Invoke leverages Python, which I hope will allow us to abstract out differences
in platforms when it comes to building and testing ein.
* Use invoke on appveyor.
* appveyor: Use the environment python.
So we can test versions other than python 2.7.
* Parsing error.
Is
https://packaging.python.org/guides/supporting-windows-using-appveyor/#setting-up
lying to me?
* Quote commands, just in case.
* Get python onto the path.
* Appveyor is catching up to travis.
* Parsing error.
* Update pip, try to get quoted syntax right.
* Still not liking my pip call.
Last try, next step we go to a requirements.txt file.
* Go to using a requirements file for pip.
* ecukes needs bash to work.
* Cleaning up and fiddling.
Seems like the emacs-jupyter guy has his act together - maybe we can take some
inspiration for our appveyor config.
* Syntax error in environment.
* More syntax errros.
* Maybe we need quoting.
* I give up.
* Formatting and cleanup.
* Add customization, yet another syntax error.
New customizable variable `ob-ein-babel-edit-polymode-ignore' to override
keybinding for \C-c\C-c in an org source code edit buffer.
* John learned some Powershell today.
* Fix the executable path.
Sometimes there is more than one curl installed on the system, make sure we can
account for that in testing.
* Handle updating the path inside invoke.
* Report which curl we are using before starting functional tests.
* Enable RDP so we can see error logs.
* Keep the build alive even when it finishes.
* Fix #568.
Apparently we need to specify the user agent when on windows, otherwise tornado
will start throwing 403 responses. Currently using Mozilla/4.0 as the agent, but
might be a good idea to make this value customizable.
* Clean up emacs config.
* Why is appveyor dropping the xsrf token?
* xsrf cookie found, what does the header look like?
* Try different user-agent header, reenable rdp.
* JSON encoding issues on Python side, it appears. Let's try an older Python.
Login works, contents query to get notebooklist works (i.e. GET on
/contents/api), but creating a notebook (i.e. POST on /contents/api) fails with
invalid JSON. ein and emacs-request appear to be generating the proper json, but
jupyter notebook does not see the same thing that is being written. Could be
bytes vs. text issue with modern v3.x python, so let us see how this all works
with Python 2.7.
* Python27 does not have pathlib out of the box.
* Make amends with Python27
* Back to python37.
Tornado/notebook still isn't reading the POST'ed json correctly.
* Do we need to specify content type?
* Must be selective in specifying application/json content.
* Re-enable rdp.
* Let's try a different curl.
* Ensure most recent curl is on path
* Try a different path.
* Try to warn user if suspicious curl detected.
* Remove debugging statements.
* EVM depends on trusty for 26.x
See issue #125 (https://github.com/rejeep/evm/issues/125). Let's hope I got the
travis.yml syntax right.
* Minimal support for ecukes from invoke.
* Cleaner server shutdowns, better ecukes support from invoke.
Use the /api/shutdown REST API call now to shutdown running server. Also support
more command line options for ecukes from invoke.
* Almost full support of ecukes using invoke.
But! Also disabling integration testing for the time being until I understand
why ecukes fails even though everything else is working.
* Just do integration and functional testing on appveyor.
Better than nothing while I work out what is breaking the integration tests.
2019-07-28 18:20:13 -06:00
( ein:warn-on-curl-version )
2018-11-09 14:50:16 -05:00
( when ( not ( eq request-backend 'curl ) )
Appveyor iterating (WIP) (#573)
* ob-ein: Bring back old functionality.
Bring back some old features to babel edit buffers while trying to respect
recent addition of polymode support.
* Override polymode if the user really wants.
Polymode is really for notebook buffers in any case, but this will override
whatever completion backmode a user has configured for python-mode.
* Install cask using python2.
For now python2 is the easiest option for testing on Windows since cask does
not properly support python3 when in Windows.
* Let's throw in the ert-runner, see what happens.
* Can I use my fork of cask?
Work around smartrep weirdness, try to live without command line wildcard
expansion.
* Get the url for the fork right.
* Experiment with python37, use test_script.
* Unstick appveyor, I hope.
* Fix parsing error.
* test_script is not executing. Why?
* Add ert testing.
But why are the test_script commands not executing?
* tasks: Automate building and testing using invoke.
Invoke leverages Python, which I hope will allow us to abstract out differences
in platforms when it comes to building and testing ein.
* Use invoke on appveyor.
* appveyor: Use the environment python.
So we can test versions other than python 2.7.
* Parsing error.
Is
https://packaging.python.org/guides/supporting-windows-using-appveyor/#setting-up
lying to me?
* Quote commands, just in case.
* Get python onto the path.
* Appveyor is catching up to travis.
* Parsing error.
* Update pip, try to get quoted syntax right.
* Still not liking my pip call.
Last try, next step we go to a requirements.txt file.
* Go to using a requirements file for pip.
* ecukes needs bash to work.
* Cleaning up and fiddling.
Seems like the emacs-jupyter guy has his act together - maybe we can take some
inspiration for our appveyor config.
* Syntax error in environment.
* More syntax errros.
* Maybe we need quoting.
* I give up.
* Formatting and cleanup.
* Add customization, yet another syntax error.
New customizable variable `ob-ein-babel-edit-polymode-ignore' to override
keybinding for \C-c\C-c in an org source code edit buffer.
* John learned some Powershell today.
* Fix the executable path.
Sometimes there is more than one curl installed on the system, make sure we can
account for that in testing.
* Handle updating the path inside invoke.
* Report which curl we are using before starting functional tests.
* Enable RDP so we can see error logs.
* Keep the build alive even when it finishes.
* Fix #568.
Apparently we need to specify the user agent when on windows, otherwise tornado
will start throwing 403 responses. Currently using Mozilla/4.0 as the agent, but
might be a good idea to make this value customizable.
* Clean up emacs config.
* Why is appveyor dropping the xsrf token?
* xsrf cookie found, what does the header look like?
* Try different user-agent header, reenable rdp.
* JSON encoding issues on Python side, it appears. Let's try an older Python.
Login works, contents query to get notebooklist works (i.e. GET on
/contents/api), but creating a notebook (i.e. POST on /contents/api) fails with
invalid JSON. ein and emacs-request appear to be generating the proper json, but
jupyter notebook does not see the same thing that is being written. Could be
bytes vs. text issue with modern v3.x python, so let us see how this all works
with Python 2.7.
* Python27 does not have pathlib out of the box.
* Make amends with Python27
* Back to python37.
Tornado/notebook still isn't reading the POST'ed json correctly.
* Do we need to specify content type?
* Must be selective in specifying application/json content.
* Re-enable rdp.
* Let's try a different curl.
* Ensure most recent curl is on path
* Try a different path.
* Try to warn user if suspicious curl detected.
* Remove debugging statements.
* EVM depends on trusty for 26.x
See issue #125 (https://github.com/rejeep/evm/issues/125). Let's hope I got the
travis.yml syntax right.
* Minimal support for ecukes from invoke.
* Cleaner server shutdowns, better ecukes support from invoke.
Use the /api/shutdown REST API call now to shutdown running server. Also support
more command line options for ecukes from invoke.
* Almost full support of ecukes using invoke.
But! Also disabling integration testing for the time being until I understand
why ecukes fails even though everything else is working.
* Just do integration and functional testing on appveyor.
Better than nothing while I work out what is breaking the integration tests.
2019-07-28 18:20:13 -06:00
( ein:display-warning
2018-11-09 14:50:16 -05:00
( format " request-backend: %s unsupported " request-backend ) )
( if ( executable-find " curl " )
( setq request-backend 'curl )
( ein:display-warning " The 'curl' program was not found " ) ) ) )
2012-12-29 19:36:53 +01:00
( defun* ein:query-singleton-ajax ( key url &rest settings
&key
( timeout ein:query-timeout )
&allow-other-keys )
2019-01-21 13:37:27 -05:00
" Do not cancel the old process if there is a process associated with
2012-12-29 19:36:53 +01:00
KEY, then call ` request ' with URL and SETTINGS. KEY is compared by
2012-06-20 20:56:04 +02:00
` equal '. "
2018-11-09 14:50:16 -05:00
( ein:query-enforce-curl )
2016-10-09 12:45:32 -05:00
( with-local-quit
( when timeout
( setq settings ( plist-put settings :timeout ( / timeout 1000.0 ) ) ) )
2019-05-03 09:23:29 -04:00
( loop do ( ein:query-running-process-table )
2018-12-05 17:15:02 -05:00
for running = ( hash-table-count ein:query-running-process-table )
until ( < running ein:max-simultaneous-queries )
do ( ein:log 'warn " ein:query-singleton-ajax: %d running processes "
running )
do ( sleep-for 3 ) )
2016-10-09 12:45:32 -05:00
( ein:aif ( gethash key ein:query-running-process-table )
( unless ( request-response-done-p it )
2018-10-17 17:44:11 -04:00
( ein:log 'debug " Race! %s %s " key ( request-response-data it ) ) ) )
2018-12-01 18:54:58 -05:00
( let ( ( response ( apply #' request ( url-encode-url url )
2017-01-03 20:11:28 -06:00
( ein:query-prepare-header url settings ) ) ) )
2016-10-09 12:45:32 -05:00
( puthash key response ein:query-running-process-table )
response ) ) )
2012-06-20 20:56:04 +02:00
2019-05-03 09:23:29 -04:00
( defun ein:query-running-process-table ( )
" Keep track of unfinished curl requests. "
2012-06-20 20:56:04 +02:00
( maphash
( lambda ( key buffer )
2012-12-29 17:05:32 +01:00
( when ( request-response-done-p buffer )
2012-06-20 20:56:04 +02:00
( remhash key ein:query-running-process-table ) ) )
ein:query-running-process-table ) )
2017-07-21 12:36:07 -05:00
( defun ein:get-response-redirect ( response )
" Determine if the query has been redirected, and if so return then URL the request was redirected to. "
( if ( length ( request-response-history response ) )
( let ( ( url ( url-generic-parse-url ( format " %s " ( request-response-url response ) ) ) ) )
( format " %s://%s:%s "
( url-type url )
( url-host url )
( url-port url ) ) ) ) )
2017-07-25 15:36:07 -05:00
2012-12-17 16:48:18 +01:00
;;; Cookie
2012-12-29 19:30:00 +01:00
( defalias 'ein:query-get-cookie 'request-cookie-string )
2012-12-17 16:48:18 +01:00
2012-05-25 20:57:48 +02:00
( provide 'ein-query )
;;; ein-query.el ends here