Not mine, but worth sharing.
I've been frustrated with the available Python testing frameworks lately, after playing around with Ruby and Node.js I just cant get enough of automated testing and coloured output. Out of the box there is no way to do this in Python, and the available modules just aren't there yet.
This is part 2 of a multi-part tutorial: Learn Test Driven Development in Flast - Part 1
Continuing from part one, its time to start on our Users and Authentication system. The first thing we should do is start a new branch in git.
Firstly, a caveat for this article: Writing this is part of my own process in learning how to TDD a flask app, I haven't done more than just play with the framework until this point and am in no way an expert. The lack of decent information out there on how to do this is stagering, so hopefully my documenting this learning process will help others starting out.
I've been wanting to play with BeautifulSoup for quite a while now but haven't really had a reason to parse any web pages. But while taking a look at my highly unscientific and probably heavily biased( most of my traffic seems to be coming from language specific sub-reddits ) "What's your favorite Scripting Language" Poll, I thought "Wouldn't it be cool to try to pull this data and plot it in python?" A perfect excuse to play with BeautifulSoup and pandas.
Write enough shell scripts and eventually you will have to write one that sends a email report, in fact now a day's I find that most shell scripts I write (the scheduled ones anyway) require some kind of notification after they have run. Likewise, if you set up enough mail servers -- usually one is enough -- you will need a quick easy way to test SMTP.
Below is a python 3 script with smtplib and argparse, which sends a test email using smtp authentication. It's short, to the point, and I hope pretty self explanatory for anyone needing to send authenticated email via python.
When I first sat down to learn Python, I was instantly disappointed with all the the available resources, and the fact that almost none of the tutorials I found seemed to work. In fact I got so frustrated with the language that I shelved the language and went to Ruby for several months. It wasn't until I paid a visit to the Windsor Hackforge and met 3 Python fanatics that I decided to take another look.