Project: INCC Crawler
Source Code: https://github.com/guilatrova/incc-crawler
Stack: Python, Lambda, BeautifulSoup
In Brazil we have an index named
INCC (Indice Nacional de Construção Civil) or
Civil Construction National Index . Basically it tracks the inflation of construction material which may affect people that bough a house under construction.
I decided to create a crawler to notify me monthly through Telegram. Just because it seems fun :)
If I had to name something that I enjoyed most on this project, I would mention how I applied chain of responsibility to build the Telegram message:
class MessageFactory: def build_message(self, overview: dtos.TableResult, complete: dtos.TableResult): builder = HeadlineBuilder() next_builder = builder.then(CurPeriodBuilder()) next_builder = next_builder.then(PrevPeriodDiffBuilder()) for prev_year in range(1, 5): next_builder = next_builder.then(PrevYearSamePeriodBuilder(prev_year)) next_builder = next_builder.then(FooterDetailsBuilder()) next_builder = next_builder.then(TrimmerBuilder()) return builder.build(overview, complete, "")
It's interesting to avoid string concatenation mess. Feel free to see the implementation for yourself HERE.
Hi there! Are you enjoying what you're reading? If you do, you can be the first to know when I post cool stuff!