Вам необходимо создать файл базы данных и таблицу для хранения информации о погоде.
См. к этому документу для установки sqlite3.
CREATE TABLE Weather (Id INTEGER AUTOINCREMENT, low_temperam VARCHAR (25))
Добавить правильные функции для обновления базы данных.
def create_connection(db_file):
try:
conn = sqlite3.connect(db_file)
return conn
except Error as e:
print(e)
return None
def weather_():
page = requests.get("https://www.bbc.com/weather/0/2562305")
soup = BeautifulSoup(page.content, 'html.parser')
today = soup.find('div',{'data-component-id' : 'forecast'})
temp = today.find(class_ = 'wr-day-temperature__low')
low_temp = (temp.get_text())
return low_temp
//Getting the data
low_temp = weather_()
//Updating the database
your_db_file= '/path_to_your_db_file/your_wheather_db.sqlite'
connector = create_connection(your_db_file)
cursor = connector .cursor()
sql = "INSERT INTO Weather(low_temperature) VALUES ('"+str(low_temp )+"')"
cursor.execute(sql)
conn.commit()
conn.close()