Help with mechanize

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

    Help with mechanize

    I'm trying to use mechanize to read for a M$ mail server. I can get past the login page OK using:

    import mechanize

    b = mechanize.Brows er()
    b.open ('https://mail.hughes.com/owa/auth/logon.aspx?url= https://mail.hughes.com/OWA/&reason=0')
    b.select_form(n r=0)
    b['username']='myname'
    b['password']='password'
    b.submit()

    Now it seems if I read b.links() I can see links to my mail. My question is, how do I now actually get the contents of this page?




  • Wojtek Walczak

    #2
    Re: Help with mechanize

    Dnia Wed, 06 Aug 2008 07:16:37 -0400, Neal Becker napisa³(a):
    I'm trying to use mechanize to read for a M$ mail server. I can get past the login page OK using:
    ....
    Now it seems if I read b.links() I can see links to my mail. My question is, how do I now actually get the contents of this page?

    Have you tried follow_link() method?
    In your case it should be something like:

    response = b.follow_link(b .links()[0]) # I suppose links()
    # returns a list or tuple
    print response.info() # headers
    print response.read() # body

    IIRC, it's described in the documentation.

    --
    Regards,
    Wojtek Walczak,

    Comment

    Working...