Writing web bots in python

Fuzzyman fuzzyman at gmail.com
Sat Mar 18 03:58:27 EST 2006


sudharsh at gmail.com wrote:
> Hello,
> I hav a question..How do I write a webbot that logs onto some website,
> fills text into a textbox and submit that form, Sorry I am a novice in
> python, apparently I have to use urllib, but I hav a few queries on
> this, What happens when there are more input interfaces..does urllib
> make somekind of a template when it does so..need more info on
> this..links and tutorilas would be appreciated..thanx
>

You should use urllib2 rather than urllib. You can see tutorials on
urllib2, and handling cookies if you need to at :

    http://www.voidspace.org.uk/python/articles/urllib2.shtml
    http://www.voidspace.org.uk/python/articles/cookielib.shtml

*However*, this only handles fetching the web pages and posting data
back. You need something that will understand the web 'form' and fill
it in for you.

You probably want Mechanize *or* something like FormEncode. Google for
these.

All the best,

Fuzzyman


> Sudharshan S




More information about the Python-list mailing list