Can I 'LOOK' through urllib?

M

Muddy Coder

Hi Folks,

I feel good after played urllib with fun!

Now I want to LOOK to server through urllib. I read the urllib docs,
but I did not find such a function. For example, if there are many
files located in http://www.somedomain.com/data_folder, but I don't
know what the filenames are residing in the data_folder. I wish urllib
would have a function to let me do it, as well as I do 'dir' in DOS,
'ls' on unix/linux. Somebody write me a demo? Thanks!


Muddy Coder
 
C

Chris Rebert

Hi Folks,

I feel good after played urllib with fun!

Now I want to LOOK to server through urllib. I read the urllib docs,
but I did not find such a function. For example, if there are many
files located in http://www.somedomain.com/data_folder, but I don't
know what the filenames are residing in the data_folder. I wish urllib
would have a function to let me do it, as well as I do 'dir' in DOS,
'ls' on unix/linux. Somebody write me a demo? Thanks!

No such functionality exists in raw HTTP (i.e. there's no LIST verb
like there is a GET verb), so it's not like Python is erroneously
leaving something out.
You either need cooperation from the server (i.e. it exposes some URL
that gives you `ls`-like output) or the filenames and/or directory
structure need to have some guessable pattern to them so that you can
just run thru the possibilities manually.
So, what you're asking for is impossible in the general case.

Cheers,
Chris
 
P

Paul Rubin

Muddy Coder said:
Now I want to LOOK to server through urllib. I read the urllib docs,
but I did not find such a function. For example, if there are many
files located in http://www.somedomain.com/data_folder, but I don't
know what the filenames are residing in the data_folder. I wish urllib
would have a function to let me do it, as well as I do 'dir' in DOS,
'ls' on unix/linux. Somebody write me a demo? Thanks!

That is done on the server side, and only if the server operator wants
to let you look at the filenames (which is not always). See for example:

http://httpd.apache.org/docs/2.2/mod/mod_autoindex.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,591
Members
45,101
Latest member
MarcusSkea
Top