Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Modify this code so that it give information of individuals who live in that location if location is found and the location i want is
Modify this code so that it give information of individuals who live in that location if location is found and the location i want is kansas city from xmlrpcserver import SimpleXMLRPCServer
import sys
import json
def loaddatagroup:
# Load data based on which portion it handles am or nz
filepath f'datagroupjson'
with openfilepath, r as file:
data json.loadfile
return data
class Worker:
def initself group:
self.data loaddatagroup
def getbynameself name:
result selfdata.getname
return error: False, 'result': result
def getbylocationself location:
result
for person in self.data.values:
if personlocation location:
result.appendperson
return error: False, 'result': result
def getbyyearself location, year:
result record for record in self.data.values if recordlocation location and recordyear year
return error: False, 'result': result
def main:
if lensysargv:
printUsage: worker.py
sysexit
port intsysargv
group sysargv
server SimpleXMLRPCServerlocalhost port
printfWorker listening on port port for group group
# Register the Worker class instance
server.registerinstanceWorkergroup
server.serveforever
if namemain:
main
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started