Package web :: Package web :: Module webapi
[hide private]
[frames] | no frames]

Module webapi

source code

Web API (wrapper around WSGI) (from web.py)

Classes [hide private]
  HTTPError
  OK
`200 OK` status
  ok
`200 OK` status
  Created
`201 Created` status
  created
`201 Created` status
  Accepted
`202 Accepted` status
  accepted
`202 Accepted` status
  Redirect
A `301 Moved Permanently` redirect.
  redirect
A `301 Moved Permanently` redirect.
  Found
A `302 Found` redirect.
  found
A `302 Found` redirect.
  SeeOther
A `303 See Other` redirect.
  seeother
A `303 See Other` redirect.
  NotModified
A `304 Not Modified` status.
  notmodified
A `304 Not Modified` status.
  TempRedirect
A `307 Temporary Redirect` redirect.
  tempredirect
A `307 Temporary Redirect` redirect.
  BadRequest
`400 Bad Request` error.
  badrequest
`400 Bad Request` error.
  _NotFound
`404 Not Found` error.
  Unauthorized
`401 Unauthorized` status
  unauthorized
`401 Unauthorized` status
  Forbidden
`403 Forbidden` status
  forbidden
`403 Forbidden` status
  NotAcceptable
`406 Not Acceptable` status
  notacceptable
`406 Not Acceptable` status
  Conflict
`409 Conflict` status
  conflict
`409 Conflict` status
  PreconditionFailed
`412 Precondition Failed` status
  preconditionfailed
`412 Precondition Failed` status
  NoMethod
A `405 Method Not Allowed` error.
  nomethod
A `405 Method Not Allowed` error.
  Gone
`410 Gone` error.
  gone
`410 Gone` error.
  _InternalError
500 Internal Server Error`.
Functions [hide private]
 
_status_code(status, data=None, classname=None, docstring=None) source code
 
NotFound(message=None)
Returns HTTPError with '404 Not Found' error from the active application.
source code
 
notfound(message=None)
Returns HTTPError with '404 Not Found' error from the active application.
source code
 
InternalError(message=None)
Returns HTTPError with '500 internal error' error from the active application.
source code
 
internalerror(message=None)
Returns HTTPError with '500 internal error' error from the active application.
source code
 
header(hdr, value, unique=False)
Adds the header `hdr: value` with the response.
source code
 
rawinput(method=None)
Returns storage object with GET or POST arguments.
source code
 
input(*requireds, **defaults)
Returns a `storage` object with the GET and POST arguments.
source code
 
data()
Returns the data sent with the request.
source code
 
setcookie(name, value, expires='', domain=None, secure=False)
Sets a cookie.
source code
 
cookies(*requireds, **defaults)
Returns a `storage` object with all the cookies in it.
source code
 
debug(*args)
Prints a prettyprinted version of `args` to stderr.
source code
 
_debugwrite(x) source code
Variables [hide private]
  config = <Storage {'debug': True, '__doc__': '\nA configuratio...
  context = <Storage {'__doc__': '\nA `storage` object containin...
  ctx = <Storage {'__doc__': '\nA `storage` object containing va...
  __package__ = 'web.web'
Function Details [hide private]

header(hdr, value, unique=False)

source code 

Adds the header `hdr: value` with the response.

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

input(*requireds, **defaults)

source code 

Returns a `storage` object with the GET and POST arguments. See `storify` for how `requireds` and `defaults` work.

cookies(*requireds, **defaults)

source code 

Returns a `storage` object with all the cookies in it. See `storify` for how `requireds` and `defaults` work.


Variables Details [hide private]

config

Value:
<Storage {'debug': True, '__doc__': '\nA configuration object for vari\
ous aspects of web.py.\n\n`debug`\n   : when True, enables reloading, \
disabled template caching and sets internalerror to debugerror.\n', 's\
ession_parameters': <Storage {'ignore_expiry': True, 'expired_message'\
: 'Session expired', 'timeout': 86400, 'ignore_change_ip': True, 'cook\
ie_domain': None, 'secret_key': 'fLjUfxqXtfNoIldA0A0J', 'cookie_name':\
 'webpy_session_id'}>}>

context

Value:
<Storage {'__doc__': '\nA `storage` object containing various informat\
ion about the request:\n  \n`environ` (aka `env`)\n   : A dictionary c\
ontaining the standard WSGI environment variables.\n\n`host`\n   : The\
 domain (`Host` header) requested by the user.\n\n`home`\n   : The bas\
e path for the application.\n\n`ip`\n   : The IP address of the reques\
ter.\n\n`method`\n   : The HTTP method used.\n\n`path`\n   : The path \
request.\n   \n`query`\n   : If there are no query arguments, the empt\
y string. Otherwise, a `?` followed\n     by the query string.\n\n`ful\
...

ctx

Value:
<Storage {'__doc__': '\nA `storage` object containing various informat\
ion about the request:\n  \n`environ` (aka `env`)\n   : A dictionary c\
ontaining the standard WSGI environment variables.\n\n`host`\n   : The\
 domain (`Host` header) requested by the user.\n\n`home`\n   : The bas\
e path for the application.\n\n`ip`\n   : The IP address of the reques\
ter.\n\n`method`\n   : The HTTP method used.\n\n`path`\n   : The path \
request.\n   \n`query`\n   : If there are no query arguments, the empt\
y string. Otherwise, a `?` followed\n     by the query string.\n\n`ful\
...