HowTo: Use OpenID with Web.py
I’m going to be using OpenID as a universal login for a new webapp I’m working on. As luck would have it Web.py has a module just for this, and the API is super simple! Now that I’ve got this working I’ve got to figure out how to actually integrate it into the app; this link looks helpful towards that.
- Install web.py:
sudo easy_install web.py
sudo apt-get install python-webpy
sudo easy_install python-openid
sudo apt-get install python-openid
import web, web.webopenid urls = ( r'/openid', 'web.webopenid.host', r'/', 'Index' ) app = web.application(urls, globals()) class Index: def GET(self): body = ''' <html><head><title>Web.py OpenID Test</title></head> <body> %s </body> </html> ''' % (web.webopenid.form('/openid')) return body if __name__ == "__main__": app.run()
- Go to http://localhost:8080
I’ve also added this to the Web.py cookbook. Please let me know if you find any bugs or mistakes!