Scrapia? That licentious app which exploits the uses of Python as refinements for its data lust, and makes both BeautifulSoup and matplotlib the servant of its wantonness!
— Mario Cavaradossi, Tosca, Act 1
Scrapia is a small tool for both collecting and analyzing data on free rooms in the JUFA Hotel Bregenz, Lake Constance, Austria.
It can be used to continually (i.e., every week or so) check which rooms are still free, visualize that information and then decide if it is time to book, as well as which date and room to choose.
The tool consists of two parts:
- The scraping script:
scrape.py
- And the analysis script:
analyze.py
Usage is very simple.
In order to scrape information from the website, run python scrape.py wet
.
If the parameter wet
is not present or some other argument is passed, the website will not be
contacted, but other functionality (e.g., the HTML parser) is still checked using a cached server
response.
To analyze the latest data, run python src/analyze.py
.
Please make sure to never execute too many wet runs of the scraper too close together. We neither want to accidentally DOS the hotel's booking system nor make them close it down or block users of this script.
You can test non-HTTP-related code using dry runs of the scraper
(just run python scrape.py
with no additional arguments), and use the previously collected CSV
files in collected_results/
for analysis.