Python OpenID

Dan Connolly connolly at w3.org
Mon Jul 4 11:40:37 PDT 2005


I can't tell if it's working or not. What's
supposed to happen after step 3 where I
put http://localhost:8082/whoever in the form?

I get page that says "Log In!" and
"No password used because this is just an example."
and when I hit the "Log In" button, it just comes
back to the same page.

Is that as designed? I'm not really clear on how
OpenID works yet.


[I'm resending this now that I'm subscribed...]

Details, including documentation alpha-testing feedback...
(I suggest you note dependency on python2.4 in the README)


I downloaded it...
http://openid.schtuff.com/Python-Openid-0.0.1.tar.gz?action=binary
2e19c86fbda466f263455190d036a6a3  Python-Openid-0.0.1.tar.gz


The lack of a top level README threw me just for a second
or two until I considered the version number and pressed on...

$ cd examples/

Ah... there's the README... so I follow the directions...

$ python httpconsumer.py
Traceback (most recent call last):
  File "httpconsumer.py", line 7, in ?
    from openid.consumer import OpenIDConsumer, SimpleHTTPClient
ImportError: No module named openid.consumer


OK, that's easy enough to work around...

$ PYTHONPATH=.. python httpconsumer.py
Consumer Server running...
Go to http://localhost:8081/ in your browser


Now I'm getting somewhere... I go there...

dirk.dm93.org - - [03/Jul/2005 15:42:30] "GET / HTTP/1.1" 200 -
dirk.dm93.org - - [03/Jul/2005 15:42:31] "GET /favicon.ico HTTP/1.1" 200
-

And then in another window...

$ PYTHONPATH=.. python sampleserver.py
Traceback (most recent call last):
  File "sampleserver.py", line 7, in ?
    from openid.server import OpenIDServer
  File "/home/connolly/src/Python-OpenID-0.0.1/openid/server.py", line
7, in ?
    from openid.trustroot import *
  File "/home/connolly/src/Python-OpenID-0.0.1/openid/trustroot.py",
line 113
    @classmethod

Ah... that looks like a 2.4-ism. The default on debian
sid is still...

$ python
Python 2.3.5 (#2, May  4 2005, 08:51:39)

I also saw this 2.4-ism on the server side:
  File "/home/connolly/src/Python-OpenID-0.0.1/openid/util.py", line 50,
in long2a
    return ''.join(reversed(pickle.encode_long(l)))
NameError: global name 'reversed' is not defined


so off to the candy store I go...

$ sudo apt-get install python2.4

and try again...


$ PYTHONPATH=.. python2.4 sampleserver.py
OpenID Example Server running...

So then I put http://localhost:8082/whoever
in the form...

In the consumer window, I see...

making initial request
dirk.dm93.org - - [03/Jul/2005 15:48:06] "GET /?identity_url=http%3A%2F%
2Flocalhost%3A8082%2Fwhoever HTTP/1.1" 302 -


and the server window shows...

$ PYTHONPATH=.. python2.4 sampleserver.py
OpenID Example Server running...
dirk.dm93.org - - [03/Jul/2005 15:46:44] "GET /whoever HTTP/1.0" 200 -
dirk.dm93.org - - [03/Jul/2005 15:47:25] "GET /whoever HTTP/1.0" 200 -
dirk.dm93.org - - [03/Jul/2005 15:48:05] "GET /whoever HTTP/1.1" 200 -
handling openid.mode='associate'
dirk.dm93.org - - [03/Jul/2005 15:48:06] "POST /?action=openid HTTP/1.1"
200 -
handling openid.mode='checkid_setup'
dirk.dm93.org - - [03/Jul/2005 15:48:06]
"GET /?action=openid&openid.mode=checkid_setup&openid.identity=http%3A%
2F%2Flocalhost%3A8082%2Fwhoever&openid.assoc_handle=%7BHMAC-SHA1%
7D1120423685%2F1&openid.return_to=http%3A%2F%2Flocalhost%3A8081%2F
HTTP/1.1" 302 -
dirk.dm93.org - - [03/Jul/2005 15:48:06]
"GET /?action=allow&trust_root=http%3A%2F%2Flocalhost%3A8081%
2F&success_to=http%3A%2F%2Flocalhost%3A8082%2F%3Faction%3Dopenid%
26openid.mode%3Dcheckid_setup%26openid.identity%3Dhttp%253A%252F%
252Flocalhost%253A8082%252Fwhoever%26openid.assoc_handle%3D%
257BHMAC-SHA1%257D1120423685%252F1%26openid.return_to%3Dhttp%253A%252F%
252Flocalhost%253A8081%252F&identity=http%3A%2F%2Flocalhost%3A8082%
2Fwhoever&fail_to=http%3A%2F%2Flocalhost%3A8081%2F%3Fopenid.mode%
3Dcancel HTTP/1.1" 200 -
dirk.dm93.org - - [03/Jul/2005 15:48:07] "GET /favicon.ico HTTP/1.1" 200
-
dirk.dm93.org - - [03/Jul/2005 15:48:35]
"GET /?action=login&fail_to=http%3A%2F%2Flocalhost%3A8081%2F%
3Fopenid.mode%3Dcancel&success_to=http%3A%2F%2Flocalhost%3A8082%2F%
3Faction%3Dopenid%26openid.mode%3Dcheckid_setup%26openid.identity%3Dhttp
%253A%252F%252Flocalhost%253A8082%252Fwhoever%26openid.assoc_handle%3D%
257BHMAC-SHA1%257D1120423685%252F1%26openid.return_to%3Dhttp%253A%252F%
252Flocalhost%253A8081%252F&user=&submit=Log+In HTTP/1.1" 200 -
dirk.dm93.org - - [03/Jul/2005 15:48:36] "GET /favicon.ico HTTP/1.1" 200
-

dirk.dm93.org - - [03/Jul/2005 15:48:06] "GET /?identity_url=http%3A%2F%
2Flocalhost%3A8082%2Fwhoever HTTP/1.1" 302 -


And that's all I can get it to do.

-- 
Dan Connolly, W3C http://www.w3.org/People/Connolly/
D3C2 887B 0F92 6005 C541  0875 0F91 96DE 6E52 C29E



More information about the yadis mailing list