Sending username password to a webpage

r0g at
Fri Nov 21 08:00:31 CET 2008

KDawg44 wrote:
> Hi,
> Is there a way to essentially simulate populating a text box and
> calling a submit button on a webpage?  I want to write an app that
> gets a users information from a website and then uses that to get
> information from another site.  The first site requires a log in.
> Thanks for any advice that gets me in the right direction.
> Thanks.
> Kevin

I dread to think why you want to do that but you probably need urllib or

You basically need to figure out if the webpage is using GET or POST to
send the form data and then URLencode and send your data as a request.

Most forms these days will use POST.

e.g. postvars = urlencode( { "name":"john", "tel":"2384792389" } )
     result = urllib.urlopen("",postvars)


More information about the Python-list mailing list