The urllib and urllib2 Modules
For simple downloads, urllib is quite all right. If you need HTTP authentication or cookies, or you want to write extensions to handle your own portocols, then urllib2 might be the right choice for you.
The urlopen function gives you a file-like object you can read from. If you would rather have urllib take care of downloading the file for you, storing a copy in a local file, you can use urlretrieve instead.
doctest , unittest
"Make it work, make it better, make it faster" : The unit testing helped make it work; source code checking can make it better; and, finally, profilling can help make it faster.
source code checking with PyChecker and PyLint