Sending username password to a webpage

Discussion in 'Python' started by KDawg44, Nov 21, 2008.

  1. KDawg44

    KDawg44 Guest

    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
     
    KDawg44, Nov 21, 2008
    #1
    1. Advertising

  2. KDawg44

    Chris Rebert Guest

    On Thu, Nov 20, 2008 at 7:52 PM, 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.


    There's the mechanize library for programmatic web browsing:
    http://wwwsearch.sourceforge.net/mechanize/

    Cheers,
    Chris
    --
    Follow the path of the Iguana...
    http://rebertia.com

    >
    > Thanks for any advice that gets me in the right direction.
    >
    > Thanks.
    >
    > Kevin
    > --
    > http://mail.python.org/mailman/listinfo/python-list
    >
     
    Chris Rebert, Nov 21, 2008
    #2
    1. Advertising

  3. KDawg44

    r0g Guest

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


    Roger.
     
    r0g, Nov 21, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. AAaron123
    Replies:
    2
    Views:
    2,376
    AAaron123
    Jan 16, 2009
  2. AAaron123
    Replies:
    1
    Views:
    1,427
    Oriane
    Jan 16, 2009
  3. Shailesh Patel
    Replies:
    0
    Views:
    493
    Shailesh Patel
    Nov 8, 2006
  4. Replies:
    6
    Views:
    178
    Paul Lalli
    Jun 13, 2006
  5. Replies:
    4
    Views:
    220
    praveen kandala
    Oct 27, 2007
Loading...

Share This Page