[PR jw/#166] lib.Uri.query_dict: Add property
Merge pull request "lib.Uri.query_dict: Add property" Upstream-repo: ssh://git@code.janware.com/janware/jw-pkg Source-branch: jan/feature/20261103-lib-uri-query-dict-add-property Target-branch: master Reviewed-on: #166
This commit is contained in:
commit
49c37f5d79
1 changed files with 15 additions and 0 deletions
|
|
@ -119,6 +119,14 @@ class Uri:
|
|||
def query(self) -> str:
|
||||
return self.__p.query
|
||||
|
||||
@cached_property
|
||||
def query_dict(self) -> dict[str, str] | None:
|
||||
if not self.query:
|
||||
return None
|
||||
from urllib.parse import parse_qsl
|
||||
|
||||
return dict(parse_qsl(self.query))
|
||||
|
||||
@cached_property
|
||||
def basename(self) -> str:
|
||||
return self.__p.path.rsplit('/')[-1]
|
||||
|
|
|
|||
Loading…
Reference in a new issue