def show_index(request):
''' main request handler '''
server.send("THIS IS INDEX PAGE!")
def show_info(request, address):
''' info request handler '''
server.send("Your IP:" + str(address))
but when the handler is called only 1 argument (request) is passed. And in show_info we get an error:
Error: Traceback (most recent call last):
File "libs/micropyserver.py", line 62, in start
TypeError: function takes 2 positional arguments but 1 were given
To enable passing 2 arguments (request, address) to a handler you should change your 62 line from route["handler"](request) to route["handler"](request, address). And correct examples: all of the handlers should take 2 arguments. Or make address optional.
Hi!
In README examples you write:
but when the handler is called only 1 argument (request) is passed. And in show_info we get an error:
To enable passing 2 arguments (request, address) to a handler you should change your 62 line from
route["handler"](request)
toroute["handler"](request, address)
. And correct examples: all of the handlers should take 2 arguments. Or makeaddress
optional.Thank you for your work!