How to use the schwifty.registry.get function in schwifty

To help you get started, we’ve selected a few schwifty examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mdomke / schwifty / schwifty / bic.py View on Github external
Args:
            country_code (str): ISO 3166 alpha2 country-code.
            bank_code (str): Country specific bank-code.

        Returns:
            BIC: a BIC object generated from the given country code and bank code.

        Raises:
            ValueError: If the given bank code wasn't found in the registry

        Note:
            This currently only works for German bank-codes.
        """
        try:
            return cls(registry.get("bank_code")[(country_code, bank_code)]["bic"])
        except KeyError:
            raise ValueError(
                "Invalid bank code {!r} for country {!r}".format(bank_code, country_code)
            )