Пример #1
0
    def __init__(self, sdk_id=None, pem_file_path=None, request_handler=None):
        self.sdk_id = sdk_id or environ.get("YOTI_CLIENT_SDK_ID")
        pem_file_path_env = environ.get("YOTI_KEY_FILE_PATH", pem_file_path)

        if pem_file_path is not None:
            error_source = "argument specified in Client()"
            self.__crypto = Crypto.read_pem_file(pem_file_path, error_source)
        elif pem_file_path_env is not None:
            error_source = "specified by the YOTI_KEY_FILE_PATH env variable"
            self.__crypto = Crypto.read_pem_file(pem_file_path_env, error_source)
        else:
            raise RuntimeError(NO_KEY_FILE_SPECIFIED_ERROR)

        self.__endpoint = Endpoint(sdk_id)
        self.__request_handler = request_handler
Пример #2
0
def test_create_signed_request_with_crypto_object(valid_base_url,
                                                  valid_endpoint):
    http_method = "GET"
    crypto = Crypto.read_pem_file(conftest.PEM_FILE_PATH)

    (SignedRequest.builder().with_pem_file(crypto).with_base_url(
        valid_base_url).with_endpoint(valid_endpoint).with_http_method(
            http_method).build())
Пример #3
0
    def with_pem_file(self, pem_file):
        """
        Sets the PEM file to be used for signing the request.  Can be an instance of yoti_python_sdk.crypto.Crypto
        or a path to a PEM file
        """
        if isinstance(pem_file, Crypto):
            self.__crypto = pem_file
        else:
            self.__crypto = Crypto.read_pem_file(pem_file)

        return self
Пример #4
0
    def __init__(self, sdk_id, pem_file, sandbox_url=None):
        if sandbox_url is None:
            sandbox_url = yoti_python_sandbox.DEFAULT_SANDBOX_URL

        self.sdk_id = sdk_id
        self.__endpoint = SandboxEndpoint(sdk_id)
        self.__sandbox_url = sandbox_url

        if isinstance(pem_file, Crypto):
            self.__crypto = pem_file
        else:
            self.__crypto = Crypto.read_pem_file(pem_file,
                                                 "SandboxClient.__init__")