step 1.2: allcaps

This commit is contained in:
DBras 2024-06-13 11:02:46 +02:00
parent e00a4587f9
commit 9aec9332fc
1 changed files with 4 additions and 0 deletions

View File

@ -8,12 +8,16 @@ def reverse_list(l):
time.sleep(1) time.sleep(1)
return l[::-1] return l[::-1]
def allcaps_list(l):
logging.debug(f'Call received: allcaps({l!r}), calculating for 1 second')
return [i.upper() for i in l]
if __name__ == "__main__": if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG) logging.basicConfig(level=logging.DEBUG)
server = SimpleXMLRPCServer(('localhost', 9000), logRequests=True) server = SimpleXMLRPCServer(('localhost', 9000), logRequests=True)
# Register the function we are serving # Register the function we are serving
server.register_function(reverse_list, 'reverse') server.register_function(reverse_list, 'reverse')
server.register_function(allcaps_list, 'allcaps')
try: try:
print("Use Control-C to exit") print("Use Control-C to exit")
# Start serving our functions # Start serving our functions