Problem accessing a web page

Antoni Mont amontfes at yahoo.es
Mon Dec 15 14:55:40 EST 2008


Hi all,

My apologises if this is not the appropriate group.

I'd like to access a web site from a python script. That page, in fact,
is a form of main page. With a browser (Firefox, for instance) I can do
it without problem: I open the main web whose url is:

'http://www.mcu.es/webISBN/tituloSimpleFilter.do?cache=init&prev_layout=busquedaisbn&layout=busquedaisbn&language=es'

and then, from the same (or another tab) I open the form (it's a book
database  and the ISBN is the relevant parameter) whose url is: 

'http://www.mcu.es/webISBN/tituloSimpleDispatch.do?params.forzaQuery=N&params.cisbnExt=8484031128&action=Buscar&layout=busquedaisbn'

So I get the information about the book.

But when I try to do the same from the script, I get a time-out
error -without time elapsing at all. This is the piece of the
script relevant for the subject:

#!/usr/bin/python
# coding: latin-1
import os, sys
import types
import time
import string
import fileinput
import re
import urllib

mcup =
urllib.urlopen('http://www.mcu.es/webISBN/tituloSimpleFilter.do?cache=init&prev_layout=busquedaisbn&layout=busquedaisbn&language=es')
# open main url
jonk = mcup.read()               # read no matter
mcui =
urllib.urlopen('http://www.mcu.es/webISBN/tituloSimpleDispatch.do?params.forzaQuery=N&params.cisbnExt=8484031128&action=Buscar&layout=busquedaisbn')
# open form for isbn
pagllibre = mcui.read() # reads it
print pagllibre         # and print it
mcui.close()            # close form
mcup.close()            # close main page

Thanks in advance, I'd appreciate any help.

Regards,
Antoni Mont
  




More information about the Python-list mailing list