gnunet-svn
[Top][All Lists]
Advanced

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

[taler-taler-util] branch master updated (abc791d -> a1c7705)


From: gnunet
Subject: [taler-taler-util] branch master updated (abc791d -> a1c7705)
Date: Fri, 29 Jan 2021 19:24:57 +0100

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

grothoff pushed a change to branch master
in repository taler-util.

    from abc791d  GANA submod
     new 43f5f0b  move PaytoParse logic into taler-util (#6650)
     new a1c7705  move PaytoParse logic into taler-util (#6650)

The 2 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.


Summary of changes:
 build-system/taler-build-scripts |  2 +-
 setup.py                         |  2 +-
 taler/util/payto.py              | 47 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 49 insertions(+), 2 deletions(-)
 create mode 100644 taler/util/payto.py

diff --git a/build-system/taler-build-scripts b/build-system/taler-build-scripts
index 47b3237..15a48fd 160000
--- a/build-system/taler-build-scripts
+++ b/build-system/taler-build-scripts
@@ -1 +1 @@
-Subproject commit 47b3237e8426c1fab05e26edaff2a1d4f099059b
+Subproject commit 15a48fda5e6463637f1af6be467f1521bcc0013e
diff --git a/setup.py b/setup.py
index 50bead5..fb1333b 100644
--- a/setup.py
+++ b/setup.py
@@ -25,7 +25,7 @@ with open('README', 'r') as f:
 
 setup(
         name='taler-util',
-        version='0.8.1',
+        version='0.8.2',
         license='LGPL3+',
         platforms='any',
         author='Taler Systems SA',
diff --git a/taler/util/payto.py b/taler/util/payto.py
new file mode 100644
index 0000000..a208028
--- /dev/null
+++ b/taler/util/payto.py
@@ -0,0 +1,47 @@
+# This file is part of GNU Taler
+# (C) 2017-2020 Taler Systems SA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 3 of the License, or (at your option) any later
+# version.
+#
+# This library 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 Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA  02110-1301  USA
+#
+# @author Marcello Stanisci
+# @version 0.1
+# @repository https://git.taler.net/taler-util.git/
+
+import re
+from urllib.parse import urlparse, parse_qsl
+from .amount import Amount
+
+class PaytoFormatError(Exception):
+    def __init__(self, msg):
+        super(PaytoFormatError, self).__init__(msg)
+        self.msg = msg
+
+class PaytoParse:
+    def __init__(self, payto_uri):
+        obj = urlparse(payto_uri)
+        path = obj.path.split("/")
+        if obj.scheme != "payto" or \
+                len(path) != 3 or \
+                not obj.netloc or \
+                not re.match("^payto://", payto_uri):
+            raise PaytoFormatError(f"Bad Payto URI: {payto_uri}")
+        self.target = path.pop()
+        self.bank = path.pop()
+        self.authority = obj.netloc
+        params = dict(parse_qsl(obj.query))
+        self.message = params.get("message")
+        self.amount = Amount.parse(params.get("amount")) if "amount" in params 
else None

-- 
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]