On Saturday, January 7, 2017 at 9:45:15 PM UTC, 黄祥 wrote:
>
> pls try :
> ### Change user with email if username is disabled
> ### Check patterns in 
> http://127.0.0.1:8000/application/controller/api/patterns.json
>
> ## curl
> # GET
> curl -X GET --user user:password -i 
> http://127.0.0.1:8000/application/controller/api/books.json
> # POST
> curl -X POST --user user:password -i -d "name=name0&website=website0" 
> http://127.0.0.1:8000/application/controller/api/books.json
> # PUT
> curl -X PUT --user user:password -i -d "name=name1&website=website1" 
> http://127.0.0.1:8000/application/controller/api/books/2.json
> # DELETE
> curl -X DELETE --user user:password -i 
> http://127.0.0.1:8000/application/controller/api/books/2.json
>
> ## Python using requests
> import requests
> from requests.auth import HTTPBasicAuth 
> payload_0 = {"name": "name0", "website": "website0"}
> payload_1 = {"name": "name1", "website": "website1"}
> auth = HTTPBasicAuth('user', 'password')
> # GET
> r = requests.get("
> http://127.0.0.1:8000/application/controller/api/bank.json";, auth = 
> auth).json()
> print r
> # POST
> r = requests.post("
> http://127.0.0.1:8000/application/controller/api/bank.json";, data = 
> payload_0, auth = auth)
> # PUT
> r = requests.put("
> http://127.0.0.1:8000/application/controller/api/bank/2.json";, data = 
> payload_1, auth = auth)
> # DELETE
> r = requests.delete("
> http://127.0.0.1:8000/application/controller/api/bank/2.json";, auth = 
> auth)
>
> best regards,
> stifan
>

Thank.it helps me a lots. i worked Python. it work well.
But My Front End is Android  and i want to know how auth user and password 
login work in restapi .
how should i send data to server .

-- 
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