Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

readerwriterpy import re This provides reading and writing of characters for sockets This is already provided by the Python library but it looked interesting to try working it out directly class reade... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Statistics The Art And Science Of Learning From Data

Authors: Alan Agresti, Christine A. Franklin

3rd Edition

9780321849281, 321755944, 321849280, 978-0321755940

More Books

Students also viewed these Programming questions