Thanks Anthony.

I end up using "auth.settings.allow_basic_login = True" suggested in 
http://web2py.com/books/default/chapter/29/9?search=auth.login_bare#Access-Control-and-Basic-Authentication

My script is as simple as:

response = 
urllib.urlopen('https://user:[email protected]/app/controller/function/')

As you can see, I am using https. Hence, I feel that using basic 
authentication should be ok.

Thanks,
Ke


On Friday, June 15, 2012 12:45:19 PM UTC-7, Anthony wrote:
>
> 1. Will Richard's script work if the value of "_formkey" is extracted from 
>> the login page?
>>
>
> The _formkey only works with sessions, which I don't think would be 
> available when running a script.
>  
>
>> 2. What does Massimo mean by "If you accept(request.vars, 
>> formname=None)"? Is it a setting that I can add in a specific file?
>>
>
> If you call form.accepts() without passing session to it (or call 
> form.process() and pass session=None), it will not generate a _formkey and 
> you therefore don't have to worry about it.
>
> Anyway, if you want to log in programmatically rather than via a form in 
> the browser, the best method is to use auth.login_bare() -- see 
> http://web2py.com/books/default/chapter/29/9#Manual-Authentication.
>
> Anthony
>
>

Reply via email to