congress.api.row_model module

class congress.api.row_model.RowModel(name, bus=None)

Bases: congress.api.base.APIModel

Model for handling API requests about Rows.

get_items(params, context=None)

Get items in model.

Param

params: A dict-like object containing parameters from the request query string and body.

Param

context: Key-values providing frame of reference of request

Returns

A dict containing at least a ‘results’ key whose value is a list of items in the model. Additional keys set in the dict will also be rendered for the user.

replace_items(items, params, context=None)

Replaces all data in a table.

Param

id_: A table id for replacing all row

Param

items: A data for new rows

Param

params: A dict-like object containing parameters from request query

Param

context: Key-values providing frame of reference of request

Returns

None

Raises
  • KeyError – table id doesn’t exist

  • DataModelException – any error occurs during replacing rows.