Hi,
I have below a simple snippet of code that should get from
wiktionary, an existing page with its contents. However, I face a problem that
the the <textarea[^\>]*> </textarea> section in the received
page is EMPTY !! Still, if I copy the same URL (http://en.wiktionary.org/w/index.php?title=%E3%82%A2&action=edit)
into my internet explorer 6.0, my resultant page indeed contains a textarea
section with valid data….
Sorry if this is a dumb question, but any clue to solve the
problem would be much appreciated !! Code snippet below – data contains
resultant page with an EMPTY textarea section:
headers = {}
headers['Content-type'] =
'application/x-www-form-urlencoded'
headers['User-Agent'] =
'PythonWikipediaBot/1.0'
request = urllib2.Request(‘http://en.wiktionary.org/w/index.php?title=%E3%82%A2&action=edit’,
'', headers)
response =
urllib2.urlopen(request)
data = response.read()
return data
Regards,
Jacob