chain of responsibility pattern in our examplewe created user based on the request this is clearly not correctbut the fact that we separated it into its own class allows us to take the code and change the get_verified_user method to get the user based on username we then verify that the password for that user is correct thenyou might want to add some code to handle the instance where the user does not exist in the database at this timewe already see lot of code relevant only to the process of checking user credentials in the main server application this feels wrong let' emphasize just how wrong it is by adding the most basic routing code possible our router will look for headerwhich tells us which endpoint was requested by the client based on this informationwe will print hello message for all casesexcept if the path contains the substring goodbyein which case the server will return goodbye message when we print out the request contentswe see that the path information is captured in the path_info header the header starts with leading "/followed by the rest of the path you can split the path on "/and then check if the path contains the word goodbye import base from pprint import prettyprinter pp prettyprinter(indent= class user(object)def __init__(selfusernamepasswordnameemail)self username username self password password self name name self email email @classmethod def get_verified_user(clsusernamepassword)return userusernamepasswordusername"{}@demo comformat(username