Axione-IPE-Viewer/webapp/eligibility_api/elig_api_routes.py
2022-11-16 16:10:30 +01:00

21 lines
708 B
Python

from flask import Flask, request
from ipe_fetcher import Axione
from eligibility_api.elig_api_exceptions import ApiParamException
class EligibilityApiRoutes:
def __init__(self, flask_app: Flask, axione_ipe: Axione):
self.flask_app = flask_app
self.axione_ipe = axione_ipe
def add_routes(self):
@self.flask_app.route("/eligibilite/axione", methods=["GET"])
def get_axione_eligibility_per_immeuble():
refimmeuble = request.args.get("refimmeuble")
if not refimmeuble:
raise ApiParamException("You need to specify path parameter 'refimmeuble'")
return self.axione_ipe.get_eligibilite_per_id_immeuble(refimmeuble)