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 !!
Why use your own code while there is a framework that does this exact thing for you?
wikipedia.Page(wikipedia.getSite('en', 'wiktionary'), '%E3%82%A2').get()
is less work, really.
Secondly, please do *not* copy pywikipedia's user-agent string when creating your own http requests; think of one yourself. The wikimedia servers are more than happy to provide you with data when using *any* user-agent so there is no reason to forge it.
Still, if I copy the same URL (http://en.wiktionary.org/w/index.php?title=%E3%82%A2 http://en.wiktionary.org/w/index.php?title=%E3%82%A2&action=edit &action=edit) into my internet explorer 6.0, my resultant page indeed contains a textarea section with valid data..
If you take a look at the outputted HTML, you should have your first clue: http://elladan/~valhallasw/uit.html
states:
"Preview
This is only a preview; changes have not yet been saved!"
Apparently your request actually sends empty data to be previewed. No, I don't know why and how. Grab Wireshark (formerly known as Ethereal) and do some network debugging. Or grab firefox with developer plugins. Or... etc ;)
Best regards, --valhallasw