On Monday, June 27, 2016 at 6:59:01 AM UTC-4, Marlysson Silva wrote:
>
> Cool, but I was no longer in gluon?
> Or it's a change?
>

Are you asking whether the webclient.py file is still in gluon? Yes, inside 
/contrib, exactly at the link shown below.

Anthony
 

>
> Em quarta-feira, 29 de agosto de 2012 19:49:14 UTC-3, Massimo Di Pierro 
> escreveu:
>>
>> 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('user/register')
>>     session_id_welcome = session.cookies['session_id_welcome']
>>     print session.forms # tells you which forms are in page (*)
>>     data = dict(first_name = 'Homer',
>>                 last_name = 'Simpson',
>>                 email = '[email protected]',
>>                 password = 'test',
>>                 password_two = 'test',
>>                 _formname = 'register')  # (*)
>>     session.post('user/register',data = data)
>>
>>     session.get('user/login')
>>     data = dict(email='[email protected]',
>>                 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
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to