也是比较重要的模块。负责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>:
A 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.