Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Need script to download file from a server using python script

2 views
Skip to first unread message

Tim Chase

unread,
Jan 23, 2009, 6:12:35 AM1/23/09
to Murali Murali, pytho...@python.org
> The build number keeps changing. So how can i use wildchars(?)
> or something else to handle change in the build no.?

Short answer: you can't...HTTP doesn't support wild-card requests.

Longer answer: presumably there's some method to the madness of
naming the file. Find the algorithm and use it.

It might be that the URL is available in some other page, so you
have to get that page, scrape it for the URL pattern, and then
use the resulting URL as your input.

It might be that the filename moves around because of some
complex algorithm you may (or may not) have access too. If you
have access to the algorithm, use it. If not, it might be that
the source is trying to make it hard for people to do exactly
what you're doing by randomly moving the file around on the
website in which case, be nice.

-tkc

Chris Rebert

unread,
Jan 23, 2009, 7:10:00 AM1/23/09
to Murali Murali, pytho...@python.org
On Fri, Jan 23, 2009 at 3:00 AM, Murali Murali
<muralimk...@yahoo.com> wrote:
> 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:

Not directly related to your main question, but you might want to use
urllib.urlretrieve() rather than httplib for the downloading of the
file as the interface is a good bit simpler. See
http://docs.python.org/library/urllib.html#urllib.urlretrieve for the
docs on it.

Cheers,
Chris

--
Follow the path of the Iguana...
http://rebertia.com

Terry Reedy

unread,
Jan 23, 2009, 5:30:11 PM1/23/09
to pytho...@python.org
Murali Murali wrote:
> 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.

Any server that dishes out files with changing names should be using the
ftp protocol that is meant for such things. It includes, I believe, a
directory request that lets clients discover filenames.

0 new messages