gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] branch master updated: CLI.


From: gnunet
Subject: [libeufin] branch master updated: CLI.
Date: Fri, 24 Jan 2020 21:45:11 +0100

This is an automated email from the git hooks/post-receive script.

marcello pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new 467fdbe  CLI.
467fdbe is described below

commit 467fdbe70d0aed6297126a8a54cdc0c77162cf14
Author: Marcello Stanisci <address@hidden>
AuthorDate: Fri Jan 24 21:44:15 2020 +0100

    CLI.
    
    - use more expressive names
    - no defaults anymore for USER-ID, PARTNER-ID, and EBICS-URL.
---
 sandbox/src/main/python/libeufin-cli | 31 +++++++++++--------------------
 1 file changed, 11 insertions(+), 20 deletions(-)

diff --git a/sandbox/src/main/python/libeufin-cli 
b/sandbox/src/main/python/libeufin-cli
index c15da46..12a2786 100755
--- a/sandbox/src/main/python/libeufin-cli
+++ b/sandbox/src/main/python/libeufin-cli
@@ -12,12 +12,12 @@ from getpass import getpass
 
 @click.group()
 @click.option(
-    "--base-url", default="http://localhost:5001/";,
+    "--nexus-base-url", default="http://localhost:5001/";,
     help="Base URL of the nexus (defaults to http://localhost:5001/)"
 )
 @click.pass_context
-def cli(ctx, base_url):
-    ctx.obj = dict(base_url=base_url)
+def cli(ctx, nexus_base_url):
+    ctx.obj = dict(nexus_base_url=nexus_base_url)
 
 @cli.group()
 def ebics():
@@ -267,17 +267,17 @@ def subscribers(obj):
 @click.option(
     "--ebics-url",
     help="URL of the EBICS server (defaults to http://localhost:5001/)",
-    required=False
+    required=True
 )
 @click.option(
     "--user-id",
-    help="ID of the user to add in the system" ,
-    required=False
+    help="ID of the user to add in the system",
+    required=True
 )
 @click.option(
     "--partner-id",
     help="ID of the partner associated with the user" ,
-    required=False
+    required=True
 )
 @click.option(
     "--system-id",
@@ -291,18 +291,9 @@ def subscribers(obj):
     default="host01"
 )
 def new_subscriber(obj, user_id, partner_id, system_id, host_id, ebics_url):
-    import random
-    
-    salt = random.randrange(0, 1000000000)
-    if not user_id:
-        user_id = "USER{}".format(salt)
-
-    if not partner_id:
-        partner_id = "PARTNER{}".format(salt)
-
-    url = urljoin(obj["base_url"], "/ebics/subscribers")
+    nexus_url = urljoin(obj["nexus_base_url"], "/ebics/subscribers")
     body = dict(
-            ebicsURL=obj["base_url"],
+            ebicsURL=ebics_url,
             userID=user_id,
             partnerID=partner_id,
             hostID=host_id
@@ -312,9 +303,9 @@ def new_subscriber(obj, user_id, partner_id, system_id, 
host_id, ebics_url):
         body.update(system_id)
 
     try:
-        resp = post(url, json=body)
+        resp = post(nexus_url, json=body)
     except Exception:
-        print("Could not reach the bank")
+        print("Could not reach the Nexus")
         return
 
     print(resp.content.decode("utf-8"))

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]