Some simplifications: I think you are going to like this: https://github.com/web2py/web2py/blob/master/gluon/contrib/webclient.py
start web2py on port 8000. Then in a normal python shell: from gluon.contrib.webclient import WebClient session = WebClient('http://127.0.0.1:8000/welcome/default/') session.get('index') session_id_welcome = session.cookies['session_id_welcome'] session.get('user/register') print session.forms # tells you which forms are in page (*) data = dict(first_name = 'Homer', last_name = 'Simpson', email = 'ho...@web2py.com', password = 'test', password_two = 'test', _formname = 'register') # (*) session.post('user/register',data = data) data = dict(email='ho...@web2py.com', password='test', _formname = 'login') session.post('user/login',data = data) session.get('index') # check registration and login were successful assert 'Welcome Homer' in session.text # check we are always in the same session assert session_id_welcome == session.cookies['session_id_welcome'] It understand sessions (not just web2py session) It understands basic auth (not used in the example) It understands web2py forms (*) and fills in the _formkeys. Suggestions for improvement? Massimo > --