luca-awesome-dotfiles/home/.config/waybar/scripts/user_location.py
2023-02-05 05:02:49 +01:00

11 lines
271 B
Python
Executable file

import requests
def get_location():
response = requests.get(f'https://ipinfo.io').json()
location_data = {
"city": response.get("city"),
"region": response.get("region"),
"country": response.get("country")
}
return location_data