This Python script utilises the uagents
library to create a simple weather alert system. The script periodically checks the current temperature in a specified city using the WeatherAPI and sends alerts when the temperature goes outside the specified range.
- Retrieves real-time weather data using the WeatherAPI.
- Sends temperature alerts when the temperature exceeds the specified range.
- Uses the
uagents
library for agent-based programming.
-
Install the required libraries: pip install uagents
-
Run the script:
python main.py
- Follow the prompts to enter the city and temperature range.
city
: Enter the name of the city for which you want to receive weather alerts.min_temp
,max_temp
: Set the minimum and maximum temperature thresholds for alerts.
- The script will run continuously, checking the temperature every 10 seconds.
- If the temperature goes outside the specified range, an alert message will be sent using
uagents
. - View the alerts in the console or logs.
- Due to limitations with
uagents
, the final completion message is printed usingprint
outside the agent context.