From 52bd11486e8ac66e1114f7e5f5055a1978f18a2a Mon Sep 17 00:00:00 2001 From: Amaury Van Espen Date: Sun, 23 Sep 2018 11:38:36 +0200 Subject: [PATCH 1/4] Update canari.quickstart.rst add windows cpp dependencies and virtualenv path to activate --- docs/canari.quickstart.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/canari.quickstart.rst b/docs/canari.quickstart.rst index 3d05c15..59ef7a9 100644 --- a/docs/canari.quickstart.rst +++ b/docs/canari.quickstart.rst @@ -54,6 +54,10 @@ first. Then install the command-line tools like so:: $ cd setuptools-18.4 && sudo python setup.py install $ sudo easy_install virtualenv +**Windows** + +read https://www.scivision.co/python-windows-visual-c++-14-required/ for dependencies on windows + Installing Canari ^^^^^^^^^^^^^^^^^ Once you have all your dependencies installed, you can now install Canari. We recommend creating a virtual environment @@ -78,6 +82,10 @@ the following:: the default Python installation. You can automate this process by adding the ``source`` statement above in your ``.profile`` or ``.bashrc`` file. +**Windows** + +In order to activate on windows use .\"env"\Scripts\activate + Once you've activated your virtual environment, it is now time to install Canari:: $ pip install canari From 991a971f212588e4f550f5a52c72e0717937a118 Mon Sep 17 00:00:00 2001 From: Amaury Van Espen Date: Sun, 23 Sep 2018 15:21:29 +0200 Subject: [PATCH 2/4] Update canari.quickstart.rst add .text method to ip_json object in order to avoid TypeError due to "response" type = 200 --- docs/canari.quickstart.rst | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/canari.quickstart.rst b/docs/canari.quickstart.rst index 3d05c15..7e32b31 100644 --- a/docs/canari.quickstart.rst +++ b/docs/canari.quickstart.rst @@ -220,10 +220,15 @@ Let's go ahead and open our ``src/hello/transforms/whatismyip.py`` transform and input_type = Location def do_transform(self, request, response, config): - ip_json = urlopen('https://api.ipify.org?format=json').read() # <-- 1 - ip_address = json.loads(ip_json)['ip'] # <------------------------- 2 - response += IPv4Address(ip_address) # <---------------------------- 3 - return response # <------------------------------------------------ 4 + ip_json = requests.get('https://api.ipify.org?format=json')# <-- 1 + ip_address = json.loads(ip_json.text)['ip'] # <----------------- 2 + response += IPv4Address(ip_address) # <------------------------- 3 + return response # <--------------------------------------------- 4 + + def on_terminate(self): + """This method gets called when transform execution is prematurely terminated. It is only applicable for local + transforms. It can be excluded if you don't need it.""" + pass The ``input_type`` class property tells Canari to expect an input entity of type ``Location``. This ensures that the From 52444c42a1bb1c6af7199b4e91e22d2ed04b9604 Mon Sep 17 00:00:00 2001 From: allfro Date: Mon, 25 Feb 2019 15:41:30 -0500 Subject: [PATCH 3/4] Update canari.quickstart.rst --- docs/canari.quickstart.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/canari.quickstart.rst b/docs/canari.quickstart.rst index 7e32b31..658a2f7 100644 --- a/docs/canari.quickstart.rst +++ b/docs/canari.quickstart.rst @@ -220,7 +220,7 @@ Let's go ahead and open our ``src/hello/transforms/whatismyip.py`` transform and input_type = Location def do_transform(self, request, response, config): - ip_json = requests.get('https://api.ipify.org?format=json')# <-- 1 + ip_json = requests.get('https://api.ipify.org?format=json') # <- 1 ip_address = json.loads(ip_json.text)['ip'] # <----------------- 2 response += IPv4Address(ip_address) # <------------------------- 3 return response # <--------------------------------------------- 4 From 95b60700f90c2cf54e046fef55025c00e03b5130 Mon Sep 17 00:00:00 2001 From: allfro Date: Mon, 25 Feb 2019 16:00:40 -0500 Subject: [PATCH 4/4] Update canari.quickstart.rst --- docs/canari.quickstart.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/canari.quickstart.rst b/docs/canari.quickstart.rst index 59ef7a9..b5b62eb 100644 --- a/docs/canari.quickstart.rst +++ b/docs/canari.quickstart.rst @@ -56,7 +56,7 @@ first. Then install the command-line tools like so:: **Windows** -read https://www.scivision.co/python-windows-visual-c++-14-required/ for dependencies on windows +It is highly recommended to install `ActivePython 3.x `_ as it provides a number of pre-compiled modules and great support. Installing Canari ^^^^^^^^^^^^^^^^^ @@ -75,6 +75,10 @@ the following:: $ source canari3/bin/activate $ which python canari3/bin/python + +To activate your virtual environment in Windows, do the following:: + + > .\canari3\Scripts\activate .. attention:: @@ -82,10 +86,6 @@ the following:: the default Python installation. You can automate this process by adding the ``source`` statement above in your ``.profile`` or ``.bashrc`` file. -**Windows** - -In order to activate on windows use .\"env"\Scripts\activate - Once you've activated your virtual environment, it is now time to install Canari:: $ pip install canari