You should have a call function in your controller:
def call():
    ...
    session.forget()
    return service()

You can expose a function like so:
@service.run
def add_two(a,b):
    if auth.is_logged_in():
        return a+b
    return 'unauthorized'

You can call like:
http://127.0.0.1:8000/app/default/call/run/add_two?a=hello&b=world
http://127.0.0.1:8000/app/default/call/run/add_two/hello/world

Is that what you're looking for?


On Dec 8, 11:59 am, Miguel Lopes <[email protected]> wrote:
> Hi,
>
> I'm looking to service another application with a web2py service.
> A goal is connect to web2py and download a file via a webservice. I've
> managed to do this using urllib (on the desktop client) and by
> exposing a service.run in web2py. But the access to the service must
> be secure, so I'm wondering on the way to authenticate it.
>
> On the client side: should / can urllib2 be used in this scenario
> (namely HTTPPassMgr)?
>
> On the web2py side: is there a standard way of exposing the run service?
>
> If there is a standard way I rather use it. Alternative, I would
> expose a custom login function through the service, return a temporary
> token and then use it in every call to exposed services. If there's no
> standard I wonder if any of you would suggest otherwise?
>
> I also wonder how an upload function exposed through this service
> would look like?
>
> Txs,
> Miguel

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to