You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sdap.apache.org by fg...@apache.org on 2018/07/17 23:27:48 UTC

[incubator-sdap-nexus] branch SDAP-125 created (now 851d067)

This is an automated email from the ASF dual-hosted git repository.

fgreg pushed a change to branch SDAP-125
in repository https://gitbox.apache.org/repos/asf/incubator-sdap-nexus.git.


      at 851d067  Remove duplicate global variable and function.

This branch includes the following new commits:

     new 851d067  Remove duplicate global variable and function.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[incubator-sdap-nexus] 01/01: Remove duplicate global variable and function.

Posted by fg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

fgreg pushed a commit to branch SDAP-125
in repository https://gitbox.apache.org/repos/asf/incubator-sdap-nexus.git

commit 851d067a7e584cdf2b3e0cdd159032d383bb7b5e
Author: Frank Greguska <fr...@jpl.nasa.gov>
AuthorDate: Tue Jul 17 16:27:19 2018 -0700

    Remove duplicate global variable and function.
---
 client/nexuscli/nexuscli_ow.py | 27 +++++++--------------------
 1 file changed, 7 insertions(+), 20 deletions(-)

diff --git a/client/nexuscli/nexuscli_ow.py b/client/nexuscli/nexuscli_ow.py
index feae3e2..4cb7bf6 100644
--- a/client/nexuscli/nexuscli_ow.py
+++ b/client/nexuscli/nexuscli_ow.py
@@ -38,40 +38,27 @@ Usage:
     valid pyspark code.  For pyspark code the variable sc may be used to 
     access the SparkContext,  but it should not create the SparkContext.
 """
-import requests
 import ast
 
-target = 'http://localhost:8084'
-
-session = requests.session()
+import requests
 
+from nexuscli import nexuscli
 
-def set_target(url, use_session=True):
-    """
-    Set the URL for the NEXUS webapp endpoint.  
-    
-    __url__ URL for NEXUS webapp endpoint   
-    __return__ None
-    """
-    global target
-    target = url
+session = requests.session()
 
-    if not use_session:
-        global session
-        session = requests
+set_target = nexuscli.set_target
 
 
 def run_file(fname):
     files = {'file': open(fname, 'rb')}
-    response = session.post(target+'/run_file', files=files)
+    response = session.post(nexuscli.target + '/run_file', files=files)
     print(response.text)
     return response.text
-    
+
 
 def run_str(code):
-    response = requests.post(target+'/run_str', data=code)
+    response = requests.post(nexuscli.target + '/run_str', data=code)
     ans = ast.literal_eval(response.text)['text/plain']
     for line in ans:
         print(line, end=" ")
     return ans
-