clientcookie/clientform and checking to see if a website accepted my login details

Discussion in 'Python' started by socialanxiety@gmail.com, Mar 5, 2007.

  1. Guest

    alright, i'm coding a program that will log me into yahoo.com (so
    far), now, the problem i have is that once i've submitted by login &
    password, the program doesn't know whether yahoo.com accepted it.
    "
    response = ClientCookie.urlopen(form.click())
    "

    now, when i get an error, the contents of 'response' will be
    different, ex: the contents of '<title>example</title>' will be
    '<title>logged in!</title>'. is there any function that can search
    through the code for that text to check if i'm logged in or not?

    all help is appreciated
    , Mar 5, 2007
    #1
    1. Advertising

  2. John J. Lee Guest

    Re: clientcookie/clientform and checking to see if a website acceptedmy login details

    writes:

    > alright, i'm coding a program that will log me into yahoo.com (so
    > far), now, the problem i have is that once i've submitted by login &
    > password, the program doesn't know whether yahoo.com accepted it.
    > "
    > response = ClientCookie.urlopen(form.click())
    > "
    >
    > now, when i get an error, the contents of 'response' will be
    > different, ex: the contents of '<title>example</title>' will be
    > '<title>logged in!</title>'. is there any function that can search
    > through the code for that text to check if i'm logged in or not?


    There's no general way to find out (regardless of whether you're using
    Python or something else). So:

    data = response.read()
    logged_in = 'logged in!' in data
    if logged_in:
    print "logged in OK"


    John
    John J. Lee, Mar 8, 2007
    #2
    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. Mark Carter

    ClientCookie bug

    Mark Carter, Aug 14, 2003, in forum: Python
    Replies:
    28
    Views:
    784
    John J. Lee
    Aug 27, 2003
  2. Grant Edwards

    Why is ClientCookie/urllib2 using https?

    Grant Edwards, Sep 24, 2003, in forum: Python
    Replies:
    0
    Views:
    317
    Grant Edwards
    Sep 24, 2003
  3. Chuck Bearden
    Replies:
    2
    Views:
    775
    Chuck Bearden
    May 11, 2004
  4. Michael Foord

    ClientCookie

    Michael Foord, Aug 11, 2004, in forum: Python
    Replies:
    11
    Views:
    739
    Michael Foord
    Aug 23, 2004
  5. DavidADEW
    Replies:
    2
    Views:
    2,693
    DavidADEW
    Sep 1, 2006
Loading...

Share This Page