Automated weather forecast for Shanghai, generated daily via GitHub Actions and the QWeather (和风天气) API.
- Daily Trigger: A GitHub Action runs every day at 20:00 UTC.
- Fetch Data: A Python script calls the QWeather API for tomorrow's forecast in Shanghai.
- Generate RSS: The script updates
weather.xmlwith the latest forecast data. - Auto-Commit: The updated XML is pushed back to this repository.
You can subscribe to this weather feed using your favorite RSS reader by using the Raw URL of the weather.xml file:
https://raw.githubusercontent.com/liusonwood/rssqweather/main/weather.xml
- Sign up at QWeather Developer Console.
- Create a "Standard Edition" or "Free Edition" project.
- Obtain your API Key.
To allow the automation to run, you must add your API key and Host to GitHub:
- Go to your repository on GitHub.
- Navigate to Settings > Secrets and variables > Actions.
- Click New repository secret for each of the following:
- Name:
QWEATHER_KEY| Value: Your API Key. - Name:
QWEATHER_HOST| Value: Your API Host (e.g.,xxx.re.qweatherapi.com).
- Name:
- Click Add secret.
Ensure the GitHub Actions bot has permission to write to your repository:
- Go to Settings > Actions > General.
- Scroll down to Workflow permissions.
- Select Read and write permissions.
- Check Allow GitHub Actions to create and approve pull requests (optional but recommended).
- Click Save.
If you want to run the script locally:
# Install dependencies
pip install -r requirements.txt
# Set your credentials
export QWEATHER_KEY="your_api_key_here"
export QWEATHER_HOST="xxx.re.qweatherapi.com"
# Run the script
python fetch_weather.pyMIT