File size: 544 Bytes
7a1f0f0
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
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."