I believe you can use the restful decorator to accept only a POST
In the following example, 'mymethod' is not a real python method - it is 
just a logical concept for convenience.

    Use this URL: /myapp/mycontroller/api/mymethod

    "fields" will be a convenient dict of data converted from urlencoded 
name=value pairs that were sent in the POST.

mycontroller.py
---------------------------
@request.restful()
def api():
# Input data format (from browser):  headers: { 'Content-Type': 
'application/x-www-form-urlencoded' }
    
    def POST(methodname, **fields):
        if not (methodname in ['mymethod']): raise HTTP(400)
        :
        # your business logic here...

I trust I have explained this correctly...

On Monday, November 24, 2014 12:56:51 PM UTC-6, محمد رشاد wrote:
>
> Hi all
> Thank you for this helpful group
> I'm new in web2py and python, I have an application that has a function 
> called "ws"
> That function has an page called "check" which accepts user inputs by this 
> "token = request.vars.token", it works and accept the inputs that come 
> using POST and GET http methods.
> What I want is to accept the POST methods only and refuse the GET ones, 
> who to do that?
>
> Thank you
>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to