[SOLVED] - there is no way to determine this if the remote server does not send the index file name (which I was looking for) back.
===========================
I have a URL and I want to find out the file name of the initial page it is loading. Eg: index.php, index.htm, index.html, default.htm, or any of the other possible start pages available.
Here is my code but it only gives the same URL as I started with. Is there any way to find out the default starting page name for this site please? ( By trying various options I have found out it is index.php
So I want it to return
http://synapse.ararat.cz/files/contrib/index.php )
Code:
import sys, os, urllib2
starturl = "http://synapse.ararat.cz/files/contrib/"
req = urllib2.Request(starturl) # , datagen, headers)
res = urllib2.urlopen(req)
finalurl = res.geturl()
print finalurl # http://synapse.ararat.cz/files/contrib/
Thanks for any help.