gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: cli helper function


From: gnunet
Subject: [libeufin] branch master updated: cli helper function
Date: Thu, 27 May 2021 13:57:46 +0200

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

ms pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new 51c5cc2  cli helper function
51c5cc2 is described below

commit 51c5cc2936ce1507de1c554f4e6ec00dd5877ae9
Author: MS <ms@taler.net>
AuthorDate: Thu May 27 13:57:37 2021 +0200

    cli helper function
---
 cli/bin/libeufin-cli | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/cli/bin/libeufin-cli b/cli/bin/libeufin-cli
index c2bc5f5..2499dd6 100755
--- a/cli/bin/libeufin-cli
+++ b/cli/bin/libeufin-cli
@@ -12,8 +12,16 @@ from urllib.parse import urljoin
 from getpass import getpass
 
 
-def tell_user(resp, withsuccess=False):
-    if resp.status_code != 200:
+# Exit the program according to the HTTP status code that
+# was received.
+def managed_exit(received_status_code, expected_status_code=200):
+    if received_status_code != expected_status_code:
+        sys.exit(1)
+    sys.exit(0)
+
+
+def tell_user(resp, expected_status_code=200, withsuccess=False):
+    if resp.status_code != expected_status_code:
         print(resp.content.decode("utf-8"))
         return
     if withsuccess:

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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