Our RESTful API won't be using the two modules included in the metrics/metrics/views
subfolder that was generated by the app template. Thus, we must delete the metrics/metrics/views/default.py
and metrics/metrics/views/notfound.py
files.
Pyramid uses view callables as the main building blocks for a RESTful API. Whenever a request arrives, Pyramid finds and invokes the appropriate view callable to process the request and return an appropriate response.
Note
View callables are callable Python objects such as functions, classes, or instances that implement a __call__
method. Any view callable receives an argument named request
that will provide the pyramid.request.Request
instance that represents an HTTP request.
In this case, we will work with view callable functions to process the requests related to metrics and metrics collections. In addition, we will take advantage of the @view_config
decorator to associate view configuration information...