davecom / PyWeatherKit

A simple Python wrapper for Apple's WeatherKit REST API.
Apache License 2.0
24 stars 12 forks source link

TypeError: 'type' object is not subscriptable #1

Closed ayush7506 closed 1 year ago

ayush7506 commented 1 year ago

from weatherkit.client import WKClient Running the above line of code throws the following error: TypeError Traceback (most recent call last) C:\Users\AYUSHS~1\AppData\Local\Temp/ipykernel_20144/1823852617.py in ----> 1 from weatherkit.client import WKClient

c:\users\ayush sinha\appdata\local\programs\python\python37\lib\site-packages\weatherkit\client.py in 23 24 ---> 25 class WKClient: 26 # Generates a WKClient that can connect to WeatherKit. 27 # key_path should be the path to a private key file.

c:\users\ayush sinha\appdata\local\programs\python\python37\lib\site-packages\weatherkit\client.py in WKClient() 40 # currentWeather, forecastDaily, forecastHourly, forecastNextHour, or weatherAlerts 41 def get_weather(self, latitude: float, longitude: float, language: str = "en", timezone: str = "America/New_York", ---> 42 dataSets: list[str] = ["currentWeather", "forecastDaily"]) -> dict: 43 if self.token.expiry < time(): 44 raise TokenExpiredError("Token has expired")

TypeError: 'type' object is not subscriptable

davecom commented 1 year ago

It looks like you are running this on Python 3.7. I haven't tested there, but am using some type hints features that only appeared in 3.8 I believe. Let me know if it doesn't run on more modern versions of Python.