470,636 Members | 1,507 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,636 developers. It's quick & easy.

Writing web bots in python

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

Sudharshan S

Mar 18 '06 #1
4 3492

su******@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/a.../urllib2.shtml
http://www.voidspace.org.uk/python/a...ookielib.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


Mar 18 '06 #2
Thanx for the info..i'll let you know when it works

Mar 18 '06 #3
<su******@gmail.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
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

Sudharshan S


C.Titus Brown gave a quick but impressive demo of twill at the Pycon
lightning talks. I think this will do just what you need.
http://www.idyll.org/~t/www-tools/twill/

-- Paul
Mar 18 '06 #4
On 2006-03-18, su******@gmail.com <su******@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


Not strictly Python related, but if you use Firefox, get the "Tamper
Data" extension for it. This lets you see exactly what Firefox is
submitting in the formdata, and what the urls are of the cgi scripts
etc.

I usually invoke a program called curl from python with os.popen, but
this twill someone has suggested looks interesting.
Mar 19 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by charliewest | last post: by
1 post views Thread by Brian W | last post: by
2 posts views Thread by Amil | last post: by
3 posts views Thread by Amit Khemka | last post: by
3 posts views Thread by randommale9999 | last post: by
3 posts views Thread by koutoo | last post: by
28 posts views Thread by William Gill | last post: by
1 post views Thread by Korara | last post: by
???
reply views Thread by Stoney L | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.