Need script to download file from a server using python script

Murali Murali muralimkrishan26 at yahoo.com
Fri Jan 23 06:00:51 EST 2009


Hi, 
I am fairly new to python and i am looking for a python script to
download file(latest build) from the server. But, the build name changes
daily. For Ex:  today the build URL will be
"http://mybuilds/myapp_1234.exe" and tomorrow it will be 
"http://myserver/mybuilds/myapp_3456.exe".  So i need a script which downloads
the latest build without any knowledge of build number. 
 Can anyone  help me? 
Advance thanks, 


This is my start:

###################################################################
import os,sys,httplib,time,
Server="myserver"
Build2Download=mybuilds/myapp_3456.exe
installer=myapp_3456.exe

    print "Downloading Installer... from the site:%s"%Server
    connection=httplib.HTTPConnection(Server)
    connection.request("GET",Build2Download)
    resp = connection.getresponse()
    if resp.status != 200:
        print "Error getting installer.  GET response : %d %s" % (resp.status, resp.reason)
        sys.exit(-1)   
    try:
        open(Installer, 'wb').write(resp.read())
        time.sleep(15)
    except:
        pass


###################################################################
The build number keeps changing. So how can i use wildchars(?) or something else to handle change in the build no.?

Advance Thanks,

Murali.



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090123/e42a128f/attachment.html>


More information about the Python-list mailing list