def fill_cafes(cafes: Cafes): c1 = Cafe('PizzaOwner', 'PizzaDay', 'Very tasty pizza', 'Dnepr') c2 = Cafe('PubOwner', 'Duck Pub', 'We have cool tea', 'Kiev') c3 = Cafe('SushiOwner', 'Sushi Iz Karasya', 'Only Japan Fish', 'Cherkasi') cafes.put(c1) cafes.put(c2) cafes.put(c3)
def read_cafe_from_req_body(req) -> Cafe: body = json.loads(req.body()) return Cafe( body["owner"], body["name"], body["des"], body["city"], id=Handler.get_int_or_none(body, "id"), )