fixed weather url encoding
This commit is contained in:
parent
526dca8c86
commit
27c0073d2a
|
@ -237,7 +237,10 @@ class Command:
|
|||
if "f" in argsplit or "u" in argsplit:
|
||||
mf = "u" # farenheit
|
||||
a = __import__("http.client").client.HTTPSConnection("wttr.in")
|
||||
a.request("GET", f"/{loc}?A&T&0&n&F&{mf}")
|
||||
b = a.getresponse().read().decode("utf-8")
|
||||
mesg(" ".join(b.split("\n")[3].strip().split(" ")[-2:]))
|
||||
x=__import__("urllib.parse").parse
|
||||
y=x.urlsplit(f"https://wttr.in/{loc}?A&T&0&n&F&{mf}")
|
||||
y=x.urlunsplit((y.scheme, y.netloc, x.quote(y.path), y.query, y.fragment))
|
||||
a=__import__("urllib.request").request.urlopen(y)
|
||||
b=a.read().decode("utf-8")
|
||||
mesg(b.split("\n")[0].strip()+" "+" ".join(b.split("\n")[3].strip().split(" ")[-2:]))
|
||||
# mesg(cmd.split(" ", 1)[1])
|
||||
|
|
Loading…
Reference in New Issue