Imagine you plan to travel to a different country but want to find a flight that fits into your budget! Isn’t it kind of annoying to keep visiting flight site’s daily to know if you can find a fare that is light on your pocket? Well, this is an attempt to automate this process via Splinter (a wrapper around Selenium), Python and Slack – for sending you updates.
The bot sends you an update every half an hour (can be adjusted) so that you never miss an opportunity to book a budget airline! Here’s the code.
- Clone this repo.
pip3 install -r requirements.txt
Sample Slack Message:
It’s a painful task to find an apartment that fits into your budget especially if you are living in San Francisco Bay Area! Wouldn’t it be nice to automate this process and post you the details via Slack whenever a new post/ad is posted by owner?
Well, inspired by this article, I have written a simpler version that gets the job done and keeps one updated with the newest post and never miss them! The code uses the libraries
The Slack-Message is as shown:
Place: Yosemite National Park, CA
Equipment: iPhone 7
Place: Point Reyes, CA
Equipment: iPhone 7
Automate the boring stuff!
Isn’t it a manual task to visit a website every day to view your favorite comic strip? Why not let a script do it for you? And maybe send it as an email attachment at a specified time every day of the week! Well, with the help of Python book, ‘Automate the Boring Stuff’ let’s create our small script to download and send that as an email attachment.
I have created
download_xkcd.py which scrapes https://xkcd.com for a comic and downloads it in a local folder. The
email_xkcd.py contains code to send the downloaded comic as an email attachment. But you don’t want to receive a duplicate comic if there is no new comic’s, right!? So, for this, I keep a record of the previous comic in a text file called
comic_records.txt which I will read before sending out an email.
I followed Ole Michelsen’s article to create a Cron Job, which is straight forward in MacOS.
To run your python script every day of the week at 6 PM, you can do something like this:
0 18 * * * cd /folder/where/your/script/resides/ && python
Note: If you are using Gmail to send an email then you will need to allow less secure apps to access Gmail! The first time you try to access Gmail using Python, your access will not be granted and you will receive an email from Google saying, Review blocked sign-in attempt, click allowing access to less secure apps link and select Turn on and there you go, you can access your gmail using Python!
Wouldn’t it be nice to get a video list along with the number of views and link to that video so that you need not visit each and every video of the conference you missed? Well, I have attempted to create such a script inspired by Miguel’s article.
I have used Python’s `requests`, `BeautifulSoup` and `multiprocessing` libraries to make this work.
The idea is simple, select a Python conference from `pyvideo.org` using `requests` module. Parse the request using `BeautifulSoup` and get all the video links of that conference. Visit each and every youtube link and collect stats like, ‘Title’, ‘URL’, and ‘Number of views’ and present it to the user.
The code can be found here. Hope you enjoy it!