aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/dash/app/pal/data/url_processing.py
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2022-06-15 14:29:02 +0200
committerTibor Frank <tifrank@cisco.com>2022-06-29 11:14:23 +0000
commit625b8361b37635f6be970f0706d6f49c6f57e8db (patch)
tree7d59a67af104750af0fd8d734cf9e5263d9c51d0 /resources/tools/dash/app/pal/data/url_processing.py
parente9149805adb068696d0a00abbac28100282b29b5 (diff)
UTI: Add comments and clean the code.
Change-Id: I6fba9aac20ed22c2ae1450161edc8c11ffa1e24d Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/tools/dash/app/pal/data/url_processing.py')
-rw-r--r--resources/tools/dash/app/pal/data/url_processing.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/resources/tools/dash/app/pal/data/url_processing.py b/resources/tools/dash/app/pal/data/url_processing.py
index 22cd034dfd..9307015d0d 100644
--- a/resources/tools/dash/app/pal/data/url_processing.py
+++ b/resources/tools/dash/app/pal/data/url_processing.py
@@ -24,8 +24,20 @@ from binascii import Error as BinasciiErr
def url_encode(params: dict) -> str:
+ """Encode the URL parameters and zip them and create the whole URL using
+ given data.
+
+ :param params: All data necessary to create the URL:
+ - scheme,
+ - network location,
+ - path,
+ - query,
+ - parameters.
+ :type params: dict
+ :returns: Encoded URL.
+ :rtype: str
"""
- """
+
url_params = params.get("params", None)
if url_params:
encoded_params = urlsafe_b64encode(
@@ -45,8 +57,14 @@ def url_encode(params: dict) -> str:
def url_decode(url: str) -> dict:
+ """Parse the given URL and decode the parameters.
+
+ :param url: URL to be parsed and decoded.
+ :type url: str
+ :returns: Paresed URL.
+ :rtype: dict
"""
- """
+
try:
parsed_url = urlparse(url)
except ValueError as err: