def init_app(self, app, config_prefix="PYBANKID"):
        """Initialize the `app` for use with this :class:`~PyBankID`. This is
        called automatically if `app` is passed to :meth:`~PyBankID.__init__`.

        The app is configured according to the configuration variables
        ``PREFIX_CERT_PATH``, ``PREFIX_KEY_PATH`` and ``PREFIX_TEST_SERVER``,
         where "PREFIX" defaults to "PYBANKID".

        :param flask.Flask app: the application to configure for use with
           this :class:`~PyBankID`
        :param str config_prefix: determines the set of configuration
           variables used to configure this :class:`~PyBankID`.

        """
        if "pybankid" not in app.extensions:
            app.extensions["pybankid"] = {}

        if config_prefix in app.extensions["pybankid"]:
            raise Exception('duplicate config_prefix "{0}"'.format(config_prefix))

        app.config.setdefault(self._config_key("CERT_PATH"), "")
        app.config.setdefault(self._config_key("KEY_PATH"), "")
        app.config.setdefault(self._config_key("TEST_SERVER"), False)

        # Adding the three url endpoints.
        app.add_url_rule(
            "/authenticate/<personal_number>", view_func=self._authenticate
        )
        app.add_url_rule("/sign/<personal_number>", view_func=self._sign)
        app.add_url_rule("/collect/<order_ref>", view_func=self._collect)

        if hasattr(app, "teardown_appcontext"):
            app.teardown_appcontext(self.teardown)
        else:
            app.teardown_request(self.teardown)
def init_app ( self , app , config_prefix = "PYBANKID" ) : if "pybankid" not in app . extensions : app . extensions [ "pybankid" ] = { } if config_prefix in app . extensions [ "pybankid" ] : raise Exception ( 'duplicate config_prefix "{0}"' . format ( config_prefix ) ) app . config . setdefault ( self . _config_key ( "CERT_PATH" ) , "" ) app . config . setdefault ( self . _config_key ( "KEY_PATH" ) , "" ) app . config . setdefault ( self . _config_key ( "TEST_SERVER" ) , False ) app . add_url_rule ( "/authenticate/<personal_number>" , view_func = self . _authenticate ) app . add_url_rule ( "/sign/<personal_number>" , view_func = self . _sign ) app . add_url_rule ( "/collect/<order_ref>" , view_func = self . _collect ) if hasattr ( app , "teardown_appcontext" ) : app . teardown_appcontext ( self . teardown ) else : app . teardown_request ( self . teardown )
Initialize the `app` for use with this :class:`~PyBankID`. This is
        called automatically if `app` is passed to :meth:`~PyBankID.__init__`.

        The app is configured according to the configuration variables
        ``PREFIX_CERT_PATH``, ``PREFIX_KEY_PATH`` and ``PREFIX_TEST_SERVER``,
         where "PREFIX" defaults to "PYBANKID".

        :param flask.Flask app: the application to configure for use with
           this :class:`~PyBankID`
        :param str config_prefix: determines the set of configuration
           variables used to configure this :class:`~PyBankID`.