Sending username password to a webpage

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • KDawg44

    Sending username password to a webpage

    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
  • Chris Rebert

    #2
    Re: Sending username password to a webpage

    On Thu, Nov 20, 2008 at 7:52 PM, KDawg44 <KDawg44@gmail. comwrote:
    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.
    There's the mechanize library for programmatic web browsing:


    Cheers,
    Chris
    --
    Follow the path of the Iguana...

    >
    Thanks for any advice that gets me in the right direction.
    >
    Thanks.
    >
    Kevin
    --

    >

    Comment

    • r0g

      #3
      Re: Sending username password to a webpage

      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
      urllib2.


      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":"joh n", "tel":"23847923 89" } )
      result = urllib.urlopen( "http://www.example.com/form1",postvars )


      Roger.

      Comment

      Working...