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

change api to get location #23

Open
nguyenhuy158 opened this issue May 30, 2024 · 1 comment
Open

change api to get location #23

nguyenhuy158 opened this issue May 30, 2024 · 1 comment

Comments

@nguyenhuy158
Copy link

I clone your repo and get error when get city from old api https://ipapi.co/json

error:

python3 $HOME/polybar-collection/scripts/weather/main.py -u metric -a 61527dc595b1f41998133d77d4d7b106
Traceback (most recent call last):
  File "/home/huy/polybar-collection/scripts/weather/main.py", line 120, in <module>
    main()
  File "/home/huy/polybar-collection/scripts/weather/main.py", line 106, in main
    city = args.city[0] if args.city else get_city()
                                          ^^^^^^^^^^
  File "/home/huy/polybar-collection/scripts/weather/main.py", line 17, in get_city
    return r.json()["city"]
           ~~~~~~~~^^^^^^^^
KeyError: 'city'

I recomment you change to http://ip-api.com/json it also free too.

@Murzchnvok
Copy link
Owner

Hmm, the API is working here, so not sure what the problem is. I probably forgot to add an exception from when you have connection problems or something. But it would be pretty easy to change the API just in case it's not working yet for you. Anyway thanks for reporting.

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

2 participants