diff --git a/docs/examples/guide/workers/weather05.py b/docs/examples/guide/workers/weather05.py index c1da80cb4d..a4d8049965 100644 --- a/docs/examples/guide/workers/weather05.py +++ b/docs/examples/guide/workers/weather05.py @@ -1,3 +1,4 @@ +from urllib.parse import quote from urllib.request import Request, urlopen from rich.text import Text @@ -30,7 +31,7 @@ def update_weather(self, city: str) -> None: worker = get_current_worker() if city: # Query the network API - url = f"https://wttr.in/{city}" + url = f"https://wttr.in/{quote(city)}" request = Request(url) request.add_header("User-agent", "CURL") response_text = urlopen(request).read().decode("utf-8")