chronoglass / weboutlook

Automatically exported from code.google.com/p/weboutlook
0 stars 0 forks source link

Authenication does not work with my corporate OWA server.. #1

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. >>> s = OutlookWebScraper('https://owa.acxiom.com/exchange',
'corp\mmarch', 'passwd')
>>> s.login()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "scraper.py", line 131, in login
    raise RetrievalError, "Couldn't find <base href> on page after logging in."
scraper.RetrievalError: Couldn't find <base href> on page after logging in.
>>> 

OR

>>> s = OutlookWebScraper('https://owa.acxiom.com ', 'corp\user', 'passwd')
>>> s.login()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "scraper.py", line 131, in login
    raise RetrievalError, "Couldn't find <base href> on page after logging in."
scraper.RetrievalError: Couldn't find <base href> on page after logging in.
>>> 

What is the expected output? What do you see instead?

A successful login

What version of the product are you using? On what operating system?

Using Python 2.4 and 2.5 under Windows, Cygwin and Linux

Please provide any additional information below.

The contents of the 'html' variable.

Original issue reported on code.google.com by mma...@gmail.com on 13 Aug 2007 at 4:04

GoogleCodeExporter commented 8 years ago
Oops.. here is the contents:

<!-- {57A118C6-2DA9-419d-BE9A-F92B0F9A418B} -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--Copyright (c) 2000-2003 Microsoft Corporation.  All rights reserved.-->
<HTML >
       <HEAD>
               <META HTTP-EQUIV="Content-Type" CONTENT="text/html;
CHARSET=iso-8859-1">
               <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
               <META HTTP-EQUIV="Expires" CONTENT="0">
               <TITLE>Microsoft Outlook Web Access</TITLE>
               <STYLE>
                       BODY {font-size:70%;}
                       TABLE {font-size:100%}

                       SELECT, INPUT, TEXTAREA, BUTTON, LABEL, BODY
                       {
                               font-family:Tahoma,Arial,Helvetica,Sans-serif;
                       }
                       a:link          { color: #3D5FA3;
text-decoration: none }
                       a:visited       { color: #3D5FA3;
text-decoration: none }
                       a:hover         { text-decoration: underline }
                       .sideBar
                       {
                               background-image:
url(/exchweb/img/logon_IE_bot.gif);
                               background-repeat: repeat-y;
                               vertical-align:left;
                               height:100%;
                       }
                       .logoTD
                       {
                               BORDER-TOP-WIDTH: 1px;
                               BORDER-LEFT-WIDTH: 1px;
                               PADDING-BOTTOM: 5px;
                               BORDER-BOTTOM: #ecbe3e 1px solid;
                               BORDER-RIGHT-WIDTH: 1px;
                       }
                       .mainTable
                       {
                               BORDER-RIGHT: #243760 1px solid;
                               BORDER-TOP: #243760 1px solid;
                               BORDER-LEFT: #243760 1px solid;
                               BORDER-BOTTOM: #243760 1px solid;
                               BORDER-COLLAPSE: collapse;
                       }
                       .standardTable
                       {
                               BORDER-COLLAPSE: collapse;
                       }
               </STYLE>

               <NOSCRIPT>
                       <TABLE id="borderTable" dir="LTR"
class="standardTable" cellSpacing=0 cellPadding=0 height="100%"
width="100%" bgColor="#3D5FA3" border=0>
                       <TR>
                               <TD width="25%"> </TD>
                               <TD width="50%"> </TD>
                               <TD width="25%"> </TD>
                       </TR>
                       <TR>
                               <TD width="25%"> </TD>
                               <TD width="50%">
                                       <TABLE style="border:2px solid
black;" cellpadding=0 cellspacing=0 valign="middle" align="center"
BGCOLOR="#FFFFE1" border=0>
                                               <TR><TD rowspan=3
width=20>  </TD><TD> </TD><TD rowspan=3
width=20>  </TD></TR>
                                               <TR>
                                                       <TD>
                                                               <font
color='red' size=3>

<P>Your Web browser is configured not to run script or doesn't support
script in Web pages.  Check your browser settings, or use a browser
that can run script. </P>
                                                               </font>
                                                       </TD>
                                               </TR>
                                               <TR><TD> </TD></TR>
                                       </TABLE>
                               </TD>
                               <TD width="25%"> </TD>
                       </TR>
                       <TR>
                               <TD width="25%"> </TD>
                               <TD width="50%"> </TD>
                               <TD width="25%"> </TD>
                       </TR>
                       </TABLE>
               </NOSCRIPT>

       <SCRIPT language="JavaScript">
       var g_fDoFocus = true;
       function setFocus()
       {
               if (g_fDoFocus)
                       window.document.logonForm.username.focus();
       }
       </SCRIPT>

       </HEAD>

       <BODY scroll="AUTO" bgColor="#FFFFFF" text="#000000"
onload="setFocus()">
               <FORM action="/exchweb/bin/auth/owaauth.dll"
method="POST" name="logonForm">

       <INPUT type="hidden" name="destination"
value="https://owa.acxiom.com/exchange">
       <INPUT type="hidden" name="flags" value="0">
       <TABLE id="borderTable" class="standardTable" cellSpacing=0
cellPadding=0 height="100%" width="100%" bgColor="#3D5FA3" border=0>
               <TR height=20>
                       <TD width="33%"> </TD>
                       <TD width="33%"> </TD>
                       <TD width="34%"> </TD>
               </TR>
               <TR>
                       <TD width="33%"> </TD>
                       <TD width="33%" valign="top">
                               <TABLE id="mainTable"
class="mainTable" cellSpacing=0 cellPadding=0 width=550
bgColor="#FFFFFF" border=0>
                                       <TR>
                                               <TD><img title=""
alt="" src="/exchweb/img/spacer.gif" width="10"></TD>
                                               <TD height="100%" valign=top>
                                                       <TABLE
id="sidebarTable" class="standardTable" height="100%" width="100%"
cellSpacing=0 cellPadding=0 border=0>
                                                       <TR><TD
width="100%" height="100%"><IMG title="" alt="" height=421
src="/exchweb/img/logon_Nav.gif" width=76 border=0></TD></TR>
                                                       </TABLE>
                                               </TD>
                                               <TD><img title=""
alt="" src="/exchweb/img/spacer.gif" width="5"></TD>
                                               <TD width="100%" valign=top>
                                                       <TABLE
id="logoTable" dir="LTR" cellSpacing=0 cellPadding=0 width="100%"
border="0" bgColor="#FFFFFF">
                                                               <TR>

 <TD vAlign=top align="right" width="100%" height=120
style="padding-top: 15">

        <IMG title="" alt="" height=12
src="/exchweb/img/logon_Microsoft.gif" width=59 border=0 hspace=10>
                                                                       </TD>
                                                               </TR>
                                                               <TR>

 <TD class="logoTD" width="100%">

                <IMG title="Microsoft Office Outlook Web Access
provided by Microsoft Exchange Server 2003" alt="Microsoft Office
Outlook Web Access provided by Microsoft Exchange Server 2003"
height=62 src="/exchweb/img/logon_logo.gif" width=331 border=0
hspace=0>

                                                                       </TD>
                                                               </TR>
                                                               <TR>

 <TD width="100%">

        <TABLE id="usertxtTable" width="100%" cellspacing=0
cellpadding=0 border=0 bgColor="#FFFFFF">

                                <TR><TD noWrap align="left"
valign="top" height="8"> </TD><TD width=10><img title="" alt=""
src="/exchweb/img/spacer.gif" width=10></TD></TR>

                                <TR><TD noWrap align="left"
valign="top" height="8"> </TD><TD width=10
rowspan=2> </TD></TR>

                        <TR>

                                <TD VALIGN=top>

                                        <TABLE id="contentTable"
width="100%" height="100%" cellpadding=0 cellspacing=0 border="0"
bgColor="#FFFFFF">

                                                <TR>

                                                 <TD NOWRAP
width="1%"><P><LABEL for="username">Domain\user name:</LABEL></P></TD>

                                                 <TD
rowspan=7>  </TD>

                                                 <TD
width="98%"><INPUT type="text" id="username" name="username"
style="width:100%" size="25" maxlength="256"></TD>

                                                 <TD
rowspan=4>  </TD>

                                                 <TD
width="1%"> </TD>

                                                </TR>

                                                <TR>

                                                 <TD height="5"></TD>

                                                 <TD valign="top"
height="5"><img title="" alt="" src="/exchweb/img/spacer.gif" width=25
height=5></TD>

                                                 <TD height=5></TD>

                                                </TR>

                                                <TR>

                                                 <TD NOWRAP
width="1%"><P><LABEL for="password">Password:</LABEL></P></TD>

                                                 <TD
width="98%"><INPUT type="password" autocomplete="off"
style="width:100%" id="password" name="password" size="25"
maxlength="256" onfocus="g_fDoFocus=false;"></TD>

                                                 <TD
width="1%"><INPUT type="submit" value="Log On" id="SubmitCreds"
name="SubmitCreds"></TD>

                                                </TR>

                                                <TR>

                                                 <TD
height="12"></TD>

                                                 <TD valign="top"
height="12"><img title="" alt="" src="/exchweb/img/spacer.gif"
width=25 height=12></TD>

                                                 <TD height=12></TD>

                                                </TR>

<TR><TD> </TD><TD colspan=4><TABLE cellspacing=0 cellpadding=0
border=0><TR><TD colspan=2 width="100%"
style="padding-bottom:3px;"><B>Security</B> </TD></TR><TR><TD
colspan="2"><TABLE cellspacing=0 cellpadding=0><TR><TD><INPUT
id="rdoPublic" checked type="radio" name="trusted" value="0"
onclick="flags.value &= 11"></TD><TD NOWRAP><LABEL
for="rdoPublic">Public or shared computer</LABEL></TD></TR><TR><TD
height=6><img title="" alt="" src="/exchweb/img/spacer.gif"
height=6></TD><TD height=6></TD></TR><TR
id="trPublic"><TD> </TD><TD>Select this option if you use Outlook
Web Access on a public computer.</TD></TR></TABLE></TD></TR><TR><TD
height=6><img title="" alt="" src="/exchweb/img/spacer.gif"
height=6></TD><TD height=6></TD></TR><TR><TD colspan="2"><TABLE
cellspacing=0 cellpadding=0><TR><TD><INPUT id="rdoTrusted"
name="trusted" type="radio" value="4" onclick="flags.value |=
4"></TD><TD NOWRAP><LABEL for="rdoTrusted">Private
computer</LABEL></TD></TR><TR><TD height=6><img title="" alt=""
src="/exchweb/img/spacer.gif" height=6></TD><TD height=6></TD></TR><TR
id="trTrusted"><TD> </TD><TD>Select this option if you are the
only person who uses this computer.</TD></TR><TR
id="trWrn"><TD> </TD><TD><FONT color="red"><B>Warning:</B> By
selecting this option you acknowledge that the computer complies with
your organization's security
policy.</FONT></TD></TR></TABLE></TD></TR></TABLE></TD></TR>

                                        </TABLE>

                                </TD>

                        </TR>

                </TABLE>

        </TD>
                                                                       </TR>

 <TR><TD colspan=2 width="100%"> </TD></TR>
                                                               </TABLE>
                                                       </TD>
                                               </TR>
                               </TABLE>
                                       <DIV dir="LTR" >
                                       <FONT color="#FFFFFF">
                                               <BR>
                                               To protect your
account from unauthorized access, Outlook Web Access automatically
closes its connection to your mailbox after a period of inactivity. If
your session ends, refresh your browser, and then log on again.
                                       </FONT>
                               </DIV>
                       </TD>
                       <TD width="34%"> </TD>
               </TR>
               <TR>
                       <TD width="33%"> </TD>
                       <TD width="33%"> </TD>
                       <TD width="34%"> </TD>
               </TR>
</TABLE>

       </FORM>
       </BODY>

</HTML>

Original comment by mma...@gmail.com on 13 Aug 2007 at 4:04

GoogleCodeExporter commented 8 years ago
I think the problem is with your constructor. The string 'corp\mmarch' will 
replace
'\m' with 'm' as \ is the escape character. Try using r'corp\mmarch' instead.

s = OutlookWebScraper('https://owa.acxiom.com/exchange', r'corp\mmarch', 
'passwd')

Original comment by surajbarkale on 28 Jul 2008 at 7:06

GoogleCodeExporter commented 8 years ago
Same issue. When I log in via a browser, and look at the source code, there is a
<BASE .. > tag.
I'm using HTTPS.

I've been using a username of the form "username", rather than 
"domain\username" or
"username@domain", where the domain differs from that on my public email 
address.

I've tried using "https//server.domain.zzz.yy" and with suffix "/exchange" to 
no avail.

I've been coding a separate python app using httplib2 (hosted on 
code.google.com),
but I havent had success with this either. However, I do know that it redirects 
after
log in. I've been sending cookies back too.

Any help would be greatly appreciated.

Original comment by sam...@gmail.com on 2 Jan 2009 at 3:08

GoogleCodeExporter commented 8 years ago
The solution for Issue 2 fixed this Issue.

Original comment by sam...@gmail.com on 2 Jan 2009 at 3:28