Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Since 5 hours the library crashes with JSONDecodeError trying to parse "Unknown location; please try <coordinate>" as JSON #1028

Open
hnsl opened this issue Oct 25, 2024 · 2 comments

Comments

@hnsl
Copy link

hnsl commented Oct 25, 2024

Traceback (most recent call last):
  File "/home/hnsl/.local/lib/python3.12/site-packages/python_weather/client.py", line 123, in get
    return Forecast(await resp.json(), unit, locale)
                    ^^^^^^^^^^^^^^^^^
  File "/home/hnsl/.local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1294, in json
    return loads(stripped.decode(encoding))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

The API doesn't support named locations anymore?

@hnsl
Copy link
Author

hnsl commented Oct 25, 2024

API seems down:

https://wttr.in/Stockholm?format=j1

Unknown location; please try ~59.3251172,18.0710935

@hnsl
Copy link
Author

hnsl commented Oct 25, 2024

I switched to using SHMI data source directly since wttr.in seems unreliable: https://opendata.smhi.se/apidocs

If if's provides global weather you could consider using that as a data source instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant