From: gert on
So I can make a recursive http download script
My goal is a one click instruction to install and launch my project
http://code.google.com/p/appwsgi/
From: alex23 on
On Apr 16, 5:37 am, gert <gert.cuyk...(a)gmail.com> wrote:
> So I can make a recursive http download script
> My goal is a one click instruction to install and launch my projecthttp://code.google.com/p/appwsgi/

Here's Guido's take on wget:

import sys, urllib
def reporthook(*a): print a
for url in sys.argv[1:]:
i = url.rfind('/')
file = url[i+1:]
print url, "->", file
urllib.urlretrieve(url, file, reporthook)

If you extend this, you can offer an easy-download-and-run python
script that does the installation you want.

But why duplicate existing effort? Why not pip[1]?

1: http://pypi.python.org/pypi/pip
From: Gabriel Genellina on
En Thu, 15 Apr 2010 16:37:37 -0300, gert <gert.cuykens(a)gmail.com> escribi�:

> [a wget -r like implementation in python3]
> So I can make a recursive http download script

What about calling wget itself? subprocess.call(['wget',...])


--
Gabriel Genellina

From: gert on
On Apr 16, 3:41 am, alex23 <wuwe...(a)gmail.com> wrote:
> On Apr 16, 5:37 am, gert <gert.cuyk...(a)gmail.com> wrote:
>
> > So I can make a recursive http download script
> > My goal is a one click instruction to install and launch my projecthttp://code.google.com/p/appwsgi/
>
> Here's Guido's take on wget:
>
>     import sys, urllib
>     def reporthook(*a): print a
>     for url in sys.argv[1:]:
>          i = url.rfind('/')
>          file = url[i+1:]
>          print url, "->", file
>          urllib.urlretrieve(url, file, reporthook)
>
> If you extend this, you can offer an easy-download-and-run python
> script that does the installation you want.
>

Guido is not talking about the same wget -r I think
I expected something like this

def hook(url):print(url)
def dir(url):
with urllib.request.urlopen(url) as f:
for u in f:
s=u.decode('latin1')
m=re.search('<li>.*href="([^\.].*)"',s)
if m:
t=url+m.group(1)
if t[-1]=='/': dir(t)
else:
d=os.path.dirname(t[33:])
if d=='': d='./'
if not os.path.exists(d):
os.makedirs(os.path.dirname(t[33:]))
urllib.request.urlretrieve(t,t[33:],hook(t))
dir('http://appwsgi.googlecode.com/hg/')

How do I get rit of 33:

> But why duplicate existing effort? Why not pip[1]?
> 1:http://pypi.python.org/pypi/pip

pip is a chainsaw, I need a pocket knife

From: gert on
On Apr 17, 1:14 am, "Gabriel Genellina" <gagsl-...(a)yahoo.com.ar>
wrote:
> En Thu, 15 Apr 2010 16:37:37 -0300, gert <gert.cuyk...(a)gmail.com> escribió:
>
> > [a wget -r like implementation in python3]
> > So I can make a recursive http download script
>
> What about calling wget itself? subprocess.call(['wget',...])
>

The only dependency I would like is python3