You need to ask for digest auth, otherwise Matterhorn has no way to know
that you're expecting a digest challenge.  So instead of getting the nonce
and other headers that your client will use to make the digest hash, you get
redirected, just like a browser would expect.

To "ask" for the digest challenge, you need to include an extra request
header, X-Requested-Auth: Digest.  So something like this should work:

headers={ 'X-Requested-Auth': 'Digest' }
item =urllib2.urlopen('http://qa.opencastproject.org:8080/welcome.html', '',
headers)

Josh

On Wed, Mar 23, 2011 at 4:23 AM, Christopher Brooks <[email protected]>wrote:

> Anyone done any python scripting against the MH REST endpoints?  I
> tried a simple digest auth call and all I got back was the login page.
> Hitting up wireshark to watch I saw the 302 redirect me, but I'm not
> really familiar with digest auth so if someone else has run into this
> before I'd love a pointer...
>
> import urllib2
>
> authinfo = urllib2.HTTPDigestAuthHandler()
> authinfo.add_password( "Opencast Matterhorn","qa.opencastproject.org:8080",
> "admin", "opencast")
>
> opener = urllib2.build_opener(authinfo)
> urllib2.install_opener(opener)
>
> item =urllib2.urlopen('http://qa.opencastproject.org:8080/welcome.html')
> item.readlines()
>
>
> Chris
> --
> Christopher Brooks, BSc, MSc
> ARIES Laboratory, University of Saskatchewan
>
> Web: http://www.cs.usask.ca/~cab938
> Phone: 1.306.966.1442
> Mail: Advanced Research in Intelligent Educational Systems Laboratory
>     Department of Computer Science
>     University of Saskatchewan
>     176 Thorvaldson Building
>     110 Science Place
>     Saskatoon, SK
>     S7N 5C9
> _______________________________________________
> Matterhorn mailing list
> [email protected]
> http://lists.opencastproject.org/mailman/listinfo/matterhorn
>
>
> To unsubscribe please email
> [email protected]
> _______________________________________________
>
_______________________________________________
Matterhorn mailing list
[email protected]
http://lists.opencastproject.org/mailman/listinfo/matterhorn


To unsubscribe please email
[email protected]
_______________________________________________

Reply via email to