lib.Uri.basename: Add property
Add a property to get a file's basename. For
https://host.com/path/to/file?key=val
.basename should return "file"".
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
fea4231b8e
commit
99b57c5f4e
1 changed files with 4 additions and 0 deletions
|
|
@ -104,6 +104,10 @@ class Uri:
|
|||
def path(self) -> str:
|
||||
return self.__p.path
|
||||
|
||||
@cached_property
|
||||
def basename(self) -> str:
|
||||
return self.__p.path.rsplit('/')[-1]
|
||||
|
||||
@cached_property
|
||||
def authority(self) -> str:
|
||||
return self.__assemble(scheme=False, credentials=True, secure=False, path=False)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue