Python OpenID library example code ================================== The examples directory contains working code illustrating the use of the library for performing OpenID authentication, both as a consumer and a server. There are two kinds of examples, one that can run without any external dependencies, and one that uses the Django Web framework. The examples do not illustrate how to use all of the features of the library, but they should be a good starting point to see how to use this library with your code. Both the Django libraries and the BaseHTTPServer examples require that the OpenID library is installed or that it has been added to Python's search path (PYTHONPATH environment variable or sys.path). The Django example is probably a good place to start reading the code. There is little that is Django-specific about the OpenID logic in the example, and it should be easy to port to any framework. To run the django examples, see the README file in the djopenid subdirectory. The other examples use Python's built-in BaseHTTPServer and have a good deal of ad-hoc dispatching and rendering code mixed in Using the BaseHTTPServer examples ================================= This directory contains a working server and consumer that use this OpenID library. They are both written using python's standard BaseHTTPServer. To run the example system: 1. Make sure you've installed the library, as explained in the installation instructions. 2. Start the consumer server: python consumer.py --port 8001 3. In another terminal, start the identity server: python server.py --port 8000 (Hit Ctrl-C in either server's window to stop that server.) 4. Open your web broswer, and go to the consumer server: http://localhost:8001/ Note that all pages the consumer server shows will have "Python OpenID Consumer Example" across the top. 5. Enter an identity url managed by the sample identity server: http://localhost:8000/id/bob 6. The browser will be redirected to the sample server, which will be requesting that you log in to proceed. Enter the username for the identity URL into the login box: bob Note that all pages the identity server shows will have "Python OpenID Server Example" across the top. 7. After you log in as bob, the server example will ask you if you want to allow http://localhost:8001/ to know your identity. Say yes. 8. You should end up back on the consumer site, at a page indicating you've logged in successfully. That's a basic OpenID login procedure. You can continue through it, playing with variations to see how they work. The python code is intended to be a straightforward example of how to use the python OpenID library to function as either an identity server or consumer. Getting help ============ Please send bug reports, patches, and other feedback to http://openid.net/developers/dev-mailing-lists/