fix url parsing
This commit is contained in:
parent
59faffbac9
commit
f8dcf4642c
|
@ -1,6 +1,6 @@
|
|||
[tool.poetry]
|
||||
name = "spartan-py"
|
||||
version = "0.2.5"
|
||||
version = "0.2.6"
|
||||
description = "Library for spartan protocol"
|
||||
authors = ["Hedy Li <hedy@tilde.cafe>"]
|
||||
packages = [
|
||||
|
|
|
@ -68,6 +68,10 @@ class Status:
|
|||
def get(url: str, data: str = ""):
|
||||
"""Fetches url and returns a response object"""
|
||||
u = urllib.parse.urlparse(url)
|
||||
if not u.hostname:
|
||||
u = urllib.parse.urlparse("spartan://"+url)
|
||||
if u.scheme != "spartan":
|
||||
raise RuntimeError("Unsupported scheme")
|
||||
if u.query: # Ignores data argument if query is in url
|
||||
data = u.query
|
||||
req = Request(u.hostname, u.port or 300, u.path or "/", data)
|
||||
|
|
Loading…
Reference in New Issue