import requests | |
from config import WEATHER_API_KEY | |
def get_weather(): | |
url = f"http://api.weatherapi.com/v1/current.json?key={WEATHER_API_KEY}&q=Black Rock Desert" | |
response = requests.get(url) | |
if response.status_code == 200: | |
data = response.json() | |
weather_info = f"Current temperature: {data['current']['temp_c']}°C\nCondition: {data['current']['condition']['text']}\nWind: {data['current']['wind_kph']} kph" | |
return weather_info | |
else: | |
return "Unable to fetch weather information at the moment." | |