HTTPS Login

Discussion in 'Python' started by Tom Grove, Aug 31, 2006.

  1. Tom Grove

    Tom Grove Guest

    I am trying to login to a secure website and I am having some difficulty
    understanding the process. Here is what I have with my limited
    knowledge of the subject:

    ##Start Code##
    #!/usr/bin/env
    python



    import
    urllib

    import
    urllib2



    #
    Main

    params =
    urllib.urlencode({

    "user" :
    "username",

    "pass" :
    "password"

    })



    req = urllib2.Request("https://web.site.com/default.aspx",
    params)
    data =
    urllib2.urlopen(req)



    for line in
    data.readlines():

    print line
    ##End Code##

    This just doesn't seem to work. It just brings me back to a login screen.

    If you can lend a hand it would be much appreciated.

    -Tom
    Tom Grove, Aug 31, 2006
    #1
    1. Advertising

  2. Tom Grove

    Thierry Lam Guest

    Instead of using the following:

    > req = urllib2.Request("https://web.site.com/default.aspx", params)
    > data = urllib2.urlopen(req)



    Try:

    data = urllib.urlopen("https://web.site.com/default.aspx", param)

    Thierry

    Tom Grove wrote:
    > I am trying to login to a secure website and I am having some difficulty
    > understanding the process. Here is what I have with my limited
    > knowledge of the subject:
    >
    > ##Start Code##
    > #!/usr/bin/env
    > python
    >
    >
    >
    > import
    > urllib
    >
    > import
    > urllib2
    >
    >
    >
    > #
    > Main
    >
    > params =
    > urllib.urlencode({
    >
    > "user" :
    > "username",
    >
    > "pass" :
    > "password"
    >
    > })
    >
    >
    >
    > req = urllib2.Request("https://web.site.com/default.aspx",
    > params)
    > data =
    > urllib2.urlopen(req)
    >
    >
    >
    > for line in
    > data.readlines():
    >
    > print line
    > ##End Code##
    >
    > This just doesn't seem to work. It just brings me back to a login screen.
    >
    > If you can lend a hand it would be much appreciated.
    >
    > -Tom
    Thierry Lam, Aug 31, 2006
    #2
    1. Advertising

  3. Tom Grove

    Gerold Penz Guest

    Tom Grove schrieb:
    > I am trying to login to a secure website and I am having some difficulty
    > understanding the process.


    Hi Tom!

    This code should do what you want:
    http://www.python-forum.de/post-18148.html#18148

    Regards,
    Gerold
    :)

    --
    ________________________________________________________________________
    Gerold Penz - bcom - Programmierung
    | http://gerold.bcom.at | http://sw3.at
    Ehrliche, herzliche Begeisterung ist einer der
    wirksamsten Erfolgsfaktoren. Dale Carnegie
    Gerold Penz, Sep 1, 2006
    #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. Stimp

    using HTTPS for a login page

    Stimp, Aug 23, 2004, in forum: ASP .Net
    Replies:
    7
    Views:
    2,783
  2. Alfredo Barrientos
    Replies:
    0
    Views:
    503
    Alfredo Barrientos
    Aug 31, 2005
  3. Axel
    Replies:
    8
    Views:
    1,054
    Adrienne Boswell
    Apr 27, 2009
  4. jotto
    Replies:
    4
    Views:
    365
    jotto
    Oct 2, 2006
  5. Naveen Dhanuka
    Replies:
    1
    Views:
    251
Loading...

Share This Page