|
Python based binary and text downloader library API for windows and linux |
|
|
|
|
Written by
|
|
Tuesday, 20 October 2009 18:34 |
|
A while ago I realised that many of the python functions available for url handling etc. dont work well in all platforms. besides some of the functions work for urls to local and others work for local to local file copies. A generic library which will copy a file irrespective of the local or remote location of its library is always a good idea IMO. As a part of the work I was doing I found the need to write my own robust downloader/copier library. This downloader allows anywhere to anywhere file copy. I called it downloader.py you have to pass the url or local file path of the file(binary or html/text) and the local location where you want it to be copied. and the function will do it  here is the syntax import downloader downloader.downloadfile(sourcepath,destinationpath) - Examples
- url to local(text)
- import downloader
downloader.downloadfile("http://abc.com/abc.html","/home/shantanu/abc.txt")
- local to local(text)
- import downloader
downloader.downloadfile("/home/shantanu/abc.txt","/home/shantanu/abc2.txt")
- url to local(Binary)
- import downloader
downloader.downloadfile("http://abc.com/abc.jpg","/home/shantanu/abc.jpg")
- local to local(text)
- import downloader
downloader.downloadfile("/home/shantanu/abc.jpg","/home/shantanu/abc2.jpg")
downloader.py has been released under GPL by me and you are free to copy modify or distribute it. I request you to keep the original credits. Happy downloading. Â Coming up: Â A project to create a spider using downloader.py [This line is replaced by a file repository when the article is viewed] |
|
Last Updated on Tuesday, 20 October 2009 18:40 |