webpy中web.webapi

也是比较重要的模块。负责http的一些数据。内容多了。

web.webapi

de>class BadRequest(HTTPError)de>: de>400 Bad Requestde> error.

de>class Found(Redirect)de>: A de>302 Foundde> redirect.

de>class Gone(HTTPError)de>: de>410 Gonede> error.

de>class HTTPError(Exception)de>: None

de>InternalError(message=None)de>: Returns HTTPError with '500 internal error' error from the active application.

de>class NoMethod(HTTPError)de>: A de>405 Method Not Allowedde> error.

de>NotFound(message=None)de>: Returns HTTPError with '404 Not Found' error from the active application.

de>class Redirect(HTTPError)de>: A de>301 Moved Permanentlyde> redirect.

de>class SeeOther(Redirect)de>: A de>303 See Otherde> redirect.

de>class TempRedirect(Redirect)de>: A de>307 Temporary Redirectde> redirect.

de>class badrequest(HTTPError)de>: de>400 Bad Requestde> error.

de>configde>:

A configuration object for various aspects of web.py.

de>debugde> : when True, enables reloading, disabled template caching and sets internalerror to debugerror.

de>cookies(*requireds, defaults)de>: Returns a de>storagede> object with all the cookies in it. See de>storifyde> for how de>requiredsde> and de>defaultsde> work.

de>ctxde>:

de>storagede> object containing various information about the request: 
de>environde> (aka de>envde>) : A dictionary containing the standard WSGI environment variables.

de>hostde> : The domain (de>Hostde> header) requested by the user.

de>homede> : The base path for the application.

de>ipde> : The IP address of the requester.

de>methodde> : The HTTP method used.

de>pathde> : The path request. 
de>queryde> : If there are no query arguments, the empty string. Otherwise, a de>?de> followed by the query string.

de>fullpathde> : The full path requested, including query arguments (de>== path + queryde>).

Response Data

de>statusde> (default: "200 OK") : The status code to be used in the response.

de>headersde> : A list of 2-tuples to be used in the response.

de>outputde> : A string to be used as the response.

de>data()de>: Returns the data sent with the request.

de>debug(*args)de>: Prints a prettyprinted version of de>argsde> to stderr.

de>class found(Redirect)de>: A de>302 Foundde> redirect.

de>class gone(HTTPError)de>: de>410 Gonede> error.

de>header(hdr, value, unique=False)de>: Adds the header de>hdr: valuede> with the response.

If de>uniquede> is True and a header with that name already exists, it doesn't add a new one.

de>input(*requireds, defaults)de>: Returns a de>storagede> object with the GET and POST arguments. See de>storifyde> for how de>requiredsde> and de>defaultsde> work.

de>internalerror(message=None)de>: Returns HTTPError with '500 internal error' error from the active application.

de>class nomethod(HTTPError)de>: A de>405 Method Not Allowedde> error.

de>notfound(message=None)de>: Returns HTTPError with '404 Not Found' error from the active application.

de>class redirect(HTTPError)de>: A de>301 Moved Permanentlyde> redirect.

de>class seeother(Redirect)de>: A de>303 See Otherde> redirect.

de>setcookie(name, value, expires='', domain=None, secure=False)de>: Sets a cookie.

de>class tempredirect(Redirect)de>: A de>307 Temporary Redirectde> redirect.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值