blaylockbk / SynopticPy

Retrieve mesonet weather data as Polars DataFrames from Synoptic's Weather API.
https://synopticpy.readthedocs.io/
MIT License
50 stars 6 forks source link

Issue Importing Synoptic API token #57

Closed charliephillips4201 closed 6 days ago

charliephillips4201 commented 3 months ago

Hi Brian,

First time trying out SynopticPy - thank you for creating this tool! I've installed via conda, and when I do the first step here (https://synopticpy.readthedocs.io/en/latest/user_guide/setup.html) of typing "import synoptic.services" and enter my API token, I get the following error. I've tried this with multiple Synoptic API tokens.

What is your Synoptic API token? >>> xxxxxxxxxxxxxxxxxxxxxxxxxxxxd47a

Thanks! I will do a quick test...
🧪 Testing your token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxd47a
Traceback (most recent call last):

  Cell In[5], line 1
    import synoptic.services

  File ~\AppData\Local\miniconda3\Lib\site-packages\synoptic\services.py:95
    from synoptic.get_token import config

  File ~\AppData\Local\miniconda3\Lib\site-packages\synoptic\get_token.py:217
    config = test_token(verbose=False)

  File ~\AppData\Local\miniconda3\Lib\site-packages\synoptic\get_token.py:142 in test_token
    return config_token()

  File ~\AppData\Local\miniconda3\Lib\site-packages\synoptic\get_token.py:209 in config_token
    config = test_token(configure_on_fail=False)

  File ~\AppData\Local\miniconda3\Lib\site-packages\synoptic\get_token.py:151 in test_token
    response = json["SUMMARY"]["RESPONSE_MESSAGE"]

KeyError: 'SUMMARY'

I've tried deleting the config file and uninstalling/reinstalling synopticpy and get the same error. I am running Python 3.12.3

Thank you for any assistance you can provide.

blaylockbk commented 2 months ago

Thanks for reporting this. I'll have to look into it. I wonder if the returned json has changed??? It seems like the "SUMMARY" key isn't there.

blaylockbk commented 6 days ago

I apologize I never got around to addressing this issue. I actually re-wrote this package from the ground up. If you're still using SynopticPy, I'd suggest trying the new upgrade (though it is a 100% breaking change) or pinning your version to the last legacy version 2024.9.0.