Question: Develop a REST server script named measurement_server.py. This script will respond to requests for data from the measurement database by sending back data that is

Develop a REST server script named measurement_server.py. This script will respond to requests for data from the measurement database by sending back data that is JSON serialized. The server should listen on any interface at a particular port number.

Here are the paths and the requests that they correspond to

Path------------------------------------------------------------------- Function

/area----------------------------------------------------------Get a list of all areas

/area/(\d+)/location----------------------------------------Get all locations for the given area id

/location/(\d+)/measurement----------------------------Get all the measurements for the given location id

/area/(\d+)/category---------------------------------------Get all the categories to which the given area belongs

/area/(\d+)/average_measurement--------------------Get the average measurement for the given area

/area/(\d+)/number_locations---------------------------Get the number of locations in the given area


Notes :

• In the first four request types, return a list of dictionaries, JSON encoded

• In the last two request types, return the numbers. JSON encoded

You may wish to follow the organization used in the sakila_rest example in class.


Overview

This assignment will use the measurements example database as a subject. You will be providing data from this database as a service using REST. The measurements example is described in the Measurements Example.pdf. But, please note! Use the file measures.sqlite rather than recreate the file yourself.


Test Setup

The project “assign05_test.zip” contains a short test. The file test2.py is the test script, the other files are support. Note: the testing files should not be in the same directory with the server. Link to all the file required: http://ksuweb.kennesaw.edu/~bsetzer/4720su16/nanoc/output/assignments/5/

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To develop a REST server using Python that responds to requests for data from a measurement database you can follow these steps Step 1 Install Require... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!