From 625b8361b37635f6be970f0706d6f49c6f57e8db Mon Sep 17 00:00:00 2001 From: Tibor Frank Date: Wed, 15 Jun 2022 14:29:02 +0200 Subject: UTI: Add comments and clean the code. Change-Id: I6fba9aac20ed22c2ae1450161edc8c11ffa1e24d Signed-off-by: Tibor Frank --- .../tools/dash/app/pal/data/url_processing.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'resources/tools/dash/app/pal/data/url_processing.py') 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: -- cgit 1.2.3-korg