client: fix image url parsing
This commit is contained in:
@@ -6,11 +6,13 @@ class Message:
|
||||
status: int
|
||||
msg: str
|
||||
headers: Dict[str, str]
|
||||
raw: str
|
||||
body: bytes
|
||||
|
||||
def __init__(self, version: str, status: int, msg: str, headers: Dict[str, str], body: bytes = None):
|
||||
def __init__(self, version: str, status: int, msg: str, headers: Dict[str, str], raw=None, body: bytes = None):
|
||||
self.version = version
|
||||
self.status = status
|
||||
self.msg = msg
|
||||
self.headers = headers
|
||||
self.raw = raw
|
||||
self.body = body
|
||||
|
@@ -245,3 +245,9 @@ def parse_uri(uri: str):
|
||||
port = 80
|
||||
|
||||
return host, port, path
|
||||
|
||||
|
||||
def base_url(uri: str):
|
||||
parsed = urlsplit(uri)
|
||||
path = parsed.path.rsplit("/", 1)[0]
|
||||
return f"{parsed.scheme}://{parsed.hostname}{path}/"
|
||||
|
Reference in New Issue
Block a user