Mercurial > libervia-web
changeset 1459:47db314e60ca
server: `getExtBaseURL` type hints
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 29 Sep 2021 17:39:35 +0200 |
parents | db13f5c768a0 |
children | 0ea54090e414 |
files | libervia/server/server.py |
diffstat | 1 files changed, 15 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libervia/server/server.py Wed Sep 29 17:39:08 2021 +0200 +++ b/libervia/server/server.py Wed Sep 29 17:39:35 2021 +0200 @@ -23,6 +23,7 @@ import urllib.request, urllib.error import time import copy +from typing import Optional from pathlib import Path from twisted.application import service from twisted.internet import reactor, defer, inotify @@ -1694,17 +1695,24 @@ "", ) - def getExtBaseURL(self, request, path="", query="", fragment="", scheme=None): + def getExtBaseURL( + self, + request: server.Request, + path: str = "", + query: str = "", + fragment: str = "", + scheme: Optional[str] = None, + ) -> str: """Get external URL according to given elements external URL is the URL seen by external user - @param path(unicode): same as for urlsplit.urlsplit + @param path: same as for urlsplit.urlsplit path will be prefixed to follow found external URL if suitable - @param params(unicode): same as for urlsplit.urlsplit - @param query(unicode): same as for urlsplit.urlsplit - @param fragment(unicode): same as for urlsplit.urlsplit - @param scheme(unicode, None): if not None, will override scheme from base URL - @return (unicode): external URL + @param params: same as for urlsplit.urlsplit + @param query: same as for urlsplit.urlsplit + @param fragment: same as for urlsplit.urlsplit + @param scheme: if not None, will override scheme from base URL + @return: external URL """ split_result = self.getExtBaseURLData(request) return urllib.parse.urlunsplit(