A custom API to scrap snow report from ski resort websites
Like most snow sport enthusiasts, I aim to leave my house at different times depending on how much new snow there is at the mountain. I wanted my raspberry Pi to access the most rececent snow report in and decide what time my alarm would go off. Since my local resort didn't seem to have a public API to give me the morning snow report I decided to build my own.
The main purpose of this project is to learn the process of building an API with Flask and will be used to collect, store and distribute the snow report for two resorts. The next project will be building the alarm clock and writing the alarm application.
- Python 3
- Flask
- Flask_RESTful
- BeautifulSoup4
- Clone the repo
git clone https://github.com/hi2gage/snow-report-api.git
- Install Pip Requirements
pip install -r requirements.txt
Current API architecture for the system
- day_id (Primary Key)
- data_time
- overnight_snow
- settled_base
- total_to_date
- six_am_temp
- twenty_four_hr_snow
- seven_day_snow
- current_conditions
- visibility
- wind
# get all snow reports
def get_all():
returns #all snow reports from database
# get most recent snow reports
def get_recent_sql():
returns #most recent snow report from database
# commits data frin current object to database
def web_to_sql():
scraps webside and adds snow report to database
return #most recent snow report from database
# resets database
def delete_all_entries():
deletes all database entries and restarts primary key auto increments
api.add_resource(fetchAll, '/')
api.add_resource(fetchRecentSQL, '/recent-sql')
api.add_resource(fetchByDate, '/date') # parameter: ?d=YYYY-MM-DD
api.add_resource(scrap, '/scrap')
- Clean up requirements.txt
- Test that the automated scheduler works
- Comment all code
- Remove all unnecessary code
- Build front side website
- Alarm Clock
- IOS app
Distributed under the MIT License. See LICENSE
for more information.