How I used a little Python to grab that perfect cabin weekend
Tags: python, beginners, lowcode, codenewbie
Published: 2022-08-22 13:42:58


![Runde fyr — one of the most sought after cabins in Norway. Photo credits: Marius Dalseg](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d9oa8aceqg3mhua2a2wg.jpeg)

As an Indian American Norwegian living in Oslo, I have gathered a, dare I say, rather eclectic set of interests. But like every Norwegian, I do love me a great cabin weekend, especially using the gem of all public services, DNT (the Norwegian Trekking Association). They offer some absolutely epic stays throughout all of Norway, with over 500 cabins at really affordable prices.

The problem is that DNT isn’t exactly a well kept secret, and these places fill up quickly during popular travel weekends, public holidays, and throughout the summer. A brilliant developer friend of mine concocted a way to send himself emails when these cabins became available. But I had no way to get in on the action other than to bother him about adding me into the mix, having to keep reminding him, sending him my preferred dates and cabins. Pretty cumbersome!


![Scenes from Flokehyttene. Photo credits: Marius Dalseg](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rea9d3wdjc51vu8gkshn.jpeg)

I figured, why not build this myself? I wanted to make something I could use myself and that I could also distribute to my friends and family!

## Building it
As a coding novice, Python is my language of choice to try making something that works. But with [Databutton](www.databutton.com), I made something that was actually cool and that I’m proud of.

![The basics of my system](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y6gi6ydzdkn7xmye63ie.png)

I made a [sign up form](https://p1dc46727-9c5a-429f-8769-a9f21ede77bd.dbtn.app/apps/cabin-grabber/) for myself and others to input their preferences — which cabin and dates are they interested in and which email address did they want to be notified to? Databutton bundles Streamlit, an easy tool to build nice looking web frontends, along with a simple way to store and fetch data as hosted dataframes. I don’t have to deal with a ton of services to make this work!

And of course I had to make a daily email service, testing out my parsing logic in a Jupyter notebook and transitioning things into a scheduled emailing job. This normally would be a pain, having to sign up for, learn and configure Sendgrid or some other service, but Databutton also provides a simple emailing function to ship html via email in just a few lines of code!

The code for sending an email every day 🧑‍💻

{% embed https://gist.github.com/vrshah2/a7e510ba3696bd929995969499b34ede %}

## The result
I was able to book a fantastic weekend during one of the busiest travel weekends in Norway, Oslo’s fall break from school. Great success! Check out my gorgeous fall day on the Norwegian coast with the requisite Kvikk Lunsj.

![A gorgeous fall day on the Norwegian coast with the requisite Kvikkl Lunsj.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mrpufujj2efcb1jcpeqf.jpg)

If you can open a .csv in Python, you can make something just as awesome for yourself, your friends or your team 🤩

## Resources
- [Databutton’s website](www.databutton.com)
- [Databutton’s documentation](docs.databutton.com)
- [The Cabin Grabber app](https://p1dc46727-9c5a-429f-8769-a9f21ede77bd.dbtn.app/apps/cabin-grabber/)
- [Github repo](https://github.com/vrshah2/cabin-grabber)