Question: 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
