def token_provider(self) -> TokenProviderAPI:
        token_provider_path = self.settings.get('TOKEN_PROVIDER')

        try:
            token_provider_class = import_string(token_provider_path)
        except ImportError:
            token_provider_class = import_string(DEFAULT_TOKEN_PROVIDER)

        return token_provider_class()
    def transaction_provider(self) -> TransactionProviderAPI:
        transaction_provider_path = self.settings.get('TRANSACTION_PROVIDER')

        try:
            transaction_provider_class = import_string(transaction_provider_path)
        except ImportError:
            transaction_provider_class = import_string(DEFAULT_TRANSACTION_PROVIDER)

        return transaction_provider_class()
Esempio n. 3
0
def get_db_backend_class(import_path: str = None) -> Type[AtomicDatabaseAPI]:
    if import_path is None:
        import_path = os.environ.get(
            'CHAIN_DB_BACKEND_CLASS',
            DEFAULT_DB_BACKEND,
        )
    return cast(Type[AtomicDatabaseAPI], import_string(import_path))
Esempio n. 4
0
 def token_provider(self) -> TokenProviderAPI:
     token_provider_class = import_string(
         self.settings.get(
             'TOKEN_PROVIDER',
             'pretix_eth.providers.BlockscoutTokenProvider',
         ))
     return token_provider_class()
Esempio n. 5
0
 def transaction_provider(self) -> TransactionProviderAPI:
     transaction_provider_class = import_string(
         self.settings.get(
             'TRANSACTION_PROVIDER',
             'pretix_eth.providers.BlockscoutTransactionProvider',
         ))
     return transaction_provider_class()
Esempio n. 6
0
def get_ipfs_backend_class(import_path: str = None) -> Type[BaseIPFSBackend]:
    if import_path is None:
        import_path = os.environ.get("ETHPM_IPFS_BACKEND_CLASS",
                                     DEFAULT_IPFS_BACKEND)
        if not import_path:
            raise CannotHandleURI(
                "Please provide an import class or set "
                "`ETHPM_IPFS_BACKEND_CLASS` environment variable.")
    return import_string(import_path)
Esempio n. 7
0
def get_ipfs_backend_class(import_path: str = None) -> Type[BaseIPFSBackend]:
    if import_path is None:
        import_path = os.environ.get("ETHPM_IPFS_BACKEND_CLASS",
                                     DEFAULT_IPFS_BACKEND)
    return import_string(import_path)