python爬取天气质量监测点历史数据

如何爬取2022年沈阳市每个空气监测点的AQI值还有空气污染物浓度


import requests
from bs4 import BeautifulSoup
import csv

url = "https://www.aqistudy.cn/historydata/daydata.php?city=%E6%B2%88%E9%98%B3&month=202205"

response = requests.get(url, headers={
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 Edg/112.0.1722.48"
})
content = response.content.decode('utf-8')
print(1, content)
soup = BeautifulSoup(content, 'lxml')
table = soup.select('.row')[0]
print(2, table)
rows = table.select('tr')[1:]

with open('aqi.csv', mode='w', newline='', encoding='utf-8-sig') as f:
    writer = csv.writer(f)
    writer.writerow(['监测点名称', 'AQI值', 'PM2.5浓度'])
    for row in rows:
        cols = row.select('td')
        position_name = cols[1].text.strip()
        aqi = cols[2].text.strip()
        pm25 = cols[3].text.strip()
        writer.writerow([position_name, aqi, pm25])

需要具有基础的Html知识和python 知识。