From 597b7306e458bb1424b0718d323cc9801b927b44 Mon Sep 17 00:00:00 2001 From: David Grayston Date: Mon, 16 Nov 2020 16:21:52 +0000 Subject: [PATCH 01/84] Update demo SDK version --- examples/aml/requirements.txt | 2 +- examples/doc_scan/requirements.in | 2 +- examples/doc_scan/requirements.txt | 3 ++- examples/yoti_example_django/requirements.in | 2 +- examples/yoti_example_django/requirements.txt | 4 ++-- examples/yoti_example_flask/requirements.in | 2 +- examples/yoti_example_flask/requirements.txt | 3 ++- 7 files changed, 10 insertions(+), 8 deletions(-) diff --git a/examples/aml/requirements.txt b/examples/aml/requirements.txt index b6c39efd..7e25054c 100644 --- a/examples/aml/requirements.txt +++ b/examples/aml/requirements.txt @@ -1,2 +1,2 @@ -yoti>=2.13.0 +yoti>=2.14.0 python-dotenv>=0.7.1 diff --git a/examples/doc_scan/requirements.in b/examples/doc_scan/requirements.in index 4bfbe87a..6c49c931 100644 --- a/examples/doc_scan/requirements.in +++ b/examples/doc_scan/requirements.in @@ -1,5 +1,5 @@ flask>=1.1.2 python-dotenv>=0.13.0 -yoti>=2.13.0 +yoti>=2.14.0 filetype>=1.0.7 pyopenssl>=19.1.0 diff --git a/examples/doc_scan/requirements.txt b/examples/doc_scan/requirements.txt index 38b136a4..5fb08a69 100644 --- a/examples/doc_scan/requirements.txt +++ b/examples/doc_scan/requirements.txt @@ -23,12 +23,13 @@ protobuf==3.11.3 # via yoti pycparser==2.20 # via cffi pyopenssl==19.1.0 # via -r requirements.in, yoti python-dotenv==0.13.0 # via -r requirements.in +pytz==2020.4 # via yoti requests==2.23.0 # via yoti six==1.14.0 # via cryptography, protobuf, pyopenssl urllib3==1.25.9 # via requests werkzeug==1.0.1 # via flask wrapt==1.12.1 # via deprecated -yoti==2.13.0 # via -r requirements.in +yoti==2.14.0 # via -r requirements.in # The following packages are considered to be unsafe in a requirements file: # setuptools diff --git a/examples/yoti_example_django/requirements.in b/examples/yoti_example_django/requirements.in index 6210c53b..3890bd95 100644 --- a/examples/yoti_example_django/requirements.in +++ b/examples/yoti_example_django/requirements.in @@ -3,4 +3,4 @@ django-sslserver>=0.22.0 python-dotenv>=0.7.1 requests>=2.20.0 urllib3>=1.24.2 -yoti>=2.13.0 +yoti>=2.14.0 diff --git a/examples/yoti_example_django/requirements.txt b/examples/yoti_example_django/requirements.txt index cd45786c..ee241f0b 100644 --- a/examples/yoti_example_django/requirements.txt +++ b/examples/yoti_example_django/requirements.txt @@ -20,13 +20,13 @@ protobuf==3.6.0 # via yoti pycparser==2.18 # via cffi pyopenssl==18.0.0 # via yoti python-dotenv==0.8.2 # via -r requirements.in -pytz==2018.4 # via django +pytz==2020.4 # via django, yoti requests==2.21.0 # via -r requirements.in, yoti six==1.11.0 # via cryptography, protobuf, pyopenssl sqlparse==0.3.0 # via django urllib3==1.24.2 # via -r requirements.in, requests wrapt==1.12.1 # via deprecated -yoti==2.13.0 # via -r requirements.in +yoti==2.14.0 # via -r requirements.in # The following packages are considered to be unsafe in a requirements file: # setuptools diff --git a/examples/yoti_example_flask/requirements.in b/examples/yoti_example_flask/requirements.in index 89c202b6..f59712fe 100644 --- a/examples/yoti_example_flask/requirements.in +++ b/examples/yoti_example_flask/requirements.in @@ -5,5 +5,5 @@ pyopenssl>=19.0.0 python-dotenv>=0.7.1 requests>=2.20.0 urllib3>=1.24.2 -yoti>=2.13.0 +yoti>=2.14.0 werkzeug>=1.0.1 diff --git a/examples/yoti_example_flask/requirements.txt b/examples/yoti_example_flask/requirements.txt index a5a293a8..6d5f67d3 100644 --- a/examples/yoti_example_flask/requirements.txt +++ b/examples/yoti_example_flask/requirements.txt @@ -22,12 +22,13 @@ protobuf==3.6.0 # via yoti pycparser==2.18 # via cffi pyopenssl==19.0.0 # via -r requirements.in, yoti python-dotenv==0.8.2 # via -r requirements.in +pytz==2020.4 # via yoti requests==2.21.0 # via -r requirements.in, yoti six==1.11.0 # via cryptography, protobuf, pyopenssl urllib3==1.24.2 # via -r requirements.in, requests werkzeug==1.0.1 # via -r requirements.in, flask wrapt==1.12.1 # via deprecated -yoti==2.13.0 # via -r requirements.in +yoti==2.14.0 # via -r requirements.in # The following packages are considered to be unsafe in a requirements file: # setuptools From 412820e54cf4fb42bbb036318cb63637b550d921 Mon Sep 17 00:00:00 2001 From: David Grayston Date: Mon, 16 Nov 2020 16:22:02 +0000 Subject: [PATCH 02/84] Bump minor version --- sonar-project.properties | 2 +- yoti_python_sdk/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sonar-project.properties b/sonar-project.properties index b8f41b51..f77622f8 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -2,7 +2,7 @@ sonar.host.url = https://sonarcloud.io sonar.organization = getyoti sonar.projectKey = getyoti:python sonar.projectName = Python SDK -sonar.projectVersion = 2.14.0 +sonar.projectVersion = 2.15.0 sonar.exclusions = yoti_python_sdk/tests/**,examples/**,yoti_python_sdk/protobuf/**/* sonar.python.pylint.reportPath = coverage.out diff --git a/yoti_python_sdk/version.py b/yoti_python_sdk/version.py index 18b49b72..f697b811 100644 --- a/yoti_python_sdk/version.py +++ b/yoti_python_sdk/version.py @@ -1,2 +1,2 @@ # -*- coding: utf-8 -*- -__version__ = "2.14.0" +__version__ = "2.15.0" From 41027339f5a4c85c3a86bfa7658a2e4440349423 Mon Sep 17 00:00:00 2001 From: David Grayston Date: Thu, 12 Nov 2020 16:51:23 +0000 Subject: [PATCH 03/84] SDK-1825: Add support for custom privacy policy URL --- examples/doc_scan/app.py | 6 ++++ examples/doc_scan/templates/privacy.html | 10 +++++++ .../doc_scan/session/create/sdk_config.py | 28 +++++++++++++++++++ .../session/create/test_sdk_config.py | 4 +++ 4 files changed, 48 insertions(+) create mode 100644 examples/doc_scan/templates/privacy.html diff --git a/examples/doc_scan/app.py b/examples/doc_scan/app.py index 3de18b4d..d550b6a6 100644 --- a/examples/doc_scan/app.py +++ b/examples/doc_scan/app.py @@ -47,6 +47,7 @@ def create_session(): .with_preset_issuing_country("GBR") .with_success_url("{url}/success".format(url=YOTI_APP_BASE_URL)) .with_error_url("{url}/error".format(url=YOTI_APP_BASE_URL)) + .with_privacy_policy_url("{url}/privacy-policy".format(url=YOTI_APP_BASE_URL)) .build() ) @@ -173,5 +174,10 @@ def media(): ) +@app.route("/privacy-policy") +def privacy_policy(): + return render_template("privacy.html") + + if __name__ == "__main__": app.run() diff --git a/examples/doc_scan/templates/privacy.html b/examples/doc_scan/templates/privacy.html new file mode 100644 index 00000000..f3b4c54a --- /dev/null +++ b/examples/doc_scan/templates/privacy.html @@ -0,0 +1,10 @@ +{% include "layout/header.html" %} +
+
+
+

Privacy Policy

+

Demo privacy policy

+
+
+
+{% include "layout/footer.html" %} \ No newline at end of file diff --git a/yoti_python_sdk/doc_scan/session/create/sdk_config.py b/yoti_python_sdk/doc_scan/session/create/sdk_config.py index c76fe897..a1427e43 100644 --- a/yoti_python_sdk/doc_scan/session/create/sdk_config.py +++ b/yoti_python_sdk/doc_scan/session/create/sdk_config.py @@ -21,6 +21,7 @@ def __init__( preset_issuing_country, success_url, error_url, + privacy_policy_url=None, ): """ :param allowed_capture_methods: the allowed capture methods @@ -39,6 +40,8 @@ def __init__( :type success_url: str :param error_url: the error url :type error_url: str + :param privacy_policy_url: the privacy policy url + :type privacy_policy_url: str """ self.__allowed_capture_methods = allowed_capture_methods self.__primary_colour = primary_colour @@ -48,6 +51,7 @@ def __init__( self.__preset_issuing_country = preset_issuing_country self.__success_url = success_url self.__error_url = error_url + self.__privacy_policy_url = privacy_policy_url @property def allowed_capture_methods(self): @@ -121,6 +125,15 @@ def error_url(self): """ return self.__error_url + @property + def privacy_policy_url(self): + """ + The privacy policy URL + + :return: the privacy policy url + """ + return self.__privacy_policy_url + def to_json(self): return remove_null_values( { @@ -132,6 +145,7 @@ def to_json(self): "preset_issuing_country": self.preset_issuing_country, "success_url": self.success_url, "error_url": self.error_url, + "privacy_policy_url": self.privacy_policy_url, } ) @@ -150,6 +164,7 @@ def __init__(self): self.__preset_issuing_country = None self.__success_url = None self.__error_url = None + self.__privacy_policy_url = None def with_allowed_capture_methods(self, allowed_capture_methods): """ @@ -265,6 +280,18 @@ def with_error_url(self, url): self.__error_url = url return self + def with_privacy_policy_url(self, url): + """ + Sets the privacy policy URL + + :param url: the privacy policy URL + :type url: str + :return: the builder + :rtype: SdkConfigBuilder + """ + self.__privacy_policy_url = url + return self + def build(self): return SdkConfig( self.__allowed_capture_methods, @@ -275,4 +302,5 @@ def build(self): self.__preset_issuing_country, self.__success_url, self.__error_url, + self.__privacy_policy_url, ) diff --git a/yoti_python_sdk/tests/doc_scan/session/create/test_sdk_config.py b/yoti_python_sdk/tests/doc_scan/session/create/test_sdk_config.py index 6de7b4ca..68d2eafe 100644 --- a/yoti_python_sdk/tests/doc_scan/session/create/test_sdk_config.py +++ b/yoti_python_sdk/tests/doc_scan/session/create/test_sdk_config.py @@ -14,6 +14,7 @@ class SdkConfigTest(unittest.TestCase): SOME_PRESET_ISSUING_COUNTRY = "USA" SOME_SUCCESS_URL = "https://mysite.com/yoti/success" SOME_ERROR_URL = "https://mysite.com/yoti/error" + SOME_PRIVACY_POLICY_URL = "https://mysite.com/privacy" def test_should_build_correctly(self): result = ( @@ -26,6 +27,7 @@ def test_should_build_correctly(self): .with_preset_issuing_country(self.SOME_PRESET_ISSUING_COUNTRY) .with_success_url(self.SOME_SUCCESS_URL) .with_error_url(self.SOME_ERROR_URL) + .with_privacy_policy_url(self.SOME_PRIVACY_POLICY_URL) .build() ) @@ -38,6 +40,7 @@ def test_should_build_correctly(self): assert result.preset_issuing_country is self.SOME_PRESET_ISSUING_COUNTRY assert result.success_url is self.SOME_SUCCESS_URL assert result.error_url is self.SOME_ERROR_URL + assert result.privacy_policy_url is self.SOME_PRIVACY_POLICY_URL def test_should_allows_camera(self): result = SdkConfigBuilder().with_allows_camera().build() @@ -55,6 +58,7 @@ def test_should_serialize_to_json_without_error(self): .with_preset_issuing_country(self.SOME_PRESET_ISSUING_COUNTRY) .with_success_url(self.SOME_SUCCESS_URL) .with_error_url(self.SOME_ERROR_URL) + .with_privacy_policy_url(self.SOME_PRIVACY_POLICY_URL) .build() ) From 85b0cc8b4fb12a245f12b15f4b5e4a9a8373cffc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Nov 2020 17:15:54 +0000 Subject: [PATCH 04/84] Bump protobuf from 3.13.0 to 3.14.0 Bumps [protobuf](https://github.com/protocolbuffers/protobuf) from 3.13.0 to 3.14.0. - [Release notes](https://github.com/protocolbuffers/protobuf/releases) - [Changelog](https://github.com/protocolbuffers/protobuf/blob/master/generate_changelog.py) - [Commits](https://github.com/protocolbuffers/protobuf/compare/v3.13.0...v3.14.0) Signed-off-by: dependabot[bot] --- requirements.in | 2 +- requirements.txt | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/requirements.in b/requirements.in index a229f183..5fb32f6b 100644 --- a/requirements.in +++ b/requirements.in @@ -4,7 +4,7 @@ cffi==1.14.3 future==0.18.2 itsdangerous==1.1.0 pbr==1.10.0 -protobuf==3.13.0 +protobuf==3.14.0 pyopenssl==19.1.0 PyYAML==5.2 # PyYAML 5.3 does not support Python 3.4 pytz==2020.4 diff --git a/requirements.txt b/requirements.txt index b8c0490b..48c781a6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,7 +15,7 @@ idna==2.7 # via requests iso8601==0.1.13 # via -r requirements.in itsdangerous==1.1.0 # via -r requirements.in pbr==1.10.0 # via -r requirements.in -protobuf==3.13.0 # via -r requirements.in +protobuf==3.14.0 # via -r requirements.in pycparser==2.18 # via cffi pyopenssl==19.1.0 # via -r requirements.in pytz==2020.4 # via -r requirements.in @@ -25,6 +25,3 @@ six==1.10.0 # via cryptography, protobuf, pyopenssl urllib3==1.24.3 # via -r requirements.in, requests wheel==0.33.6 # via -r requirements.in wrapt==1.11.2 # via deprecated - -# The following packages are considered to be unsafe in a requirements file: -# setuptools From f41f583d798e8e4df34d55e4b5e565cb3295844b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Dec 2020 05:17:22 +0000 Subject: [PATCH 05/84] Bump cffi from 1.14.3 to 1.14.4 Bumps [cffi](https://github.com/python-cffi/release-doc) from 1.14.3 to 1.14.4. - [Release notes](https://github.com/python-cffi/release-doc/releases) - [Commits](https://github.com/python-cffi/release-doc/commits) Signed-off-by: dependabot[bot] --- requirements.in | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.in b/requirements.in index 5fb32f6b..569f4af8 100644 --- a/requirements.in +++ b/requirements.in @@ -1,6 +1,6 @@ asn1==2.2.0 # asn1 2.3.0 introduces enum34 as a dependency, which causes problems on some envs cryptography==2.8.0 -cffi==1.14.3 +cffi==1.14.4 future==0.18.2 itsdangerous==1.1.0 pbr==1.10.0 diff --git a/requirements.txt b/requirements.txt index 48c781a6..42201f80 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ # asn1==2.2.0 # via -r requirements.in certifi==2018.11.29 # via requests -cffi==1.14.3 # via -r requirements.in, cryptography +cffi==1.14.4 # via -r requirements.in, cryptography chardet==3.0.4 # via requests cryptography==2.8 # via -r requirements.in, pyopenssl deprecated==1.2.10 # via -r requirements.in From 5468a722af1433a1bdad69ca27fc834b980e88fc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Dec 2020 05:16:11 +0000 Subject: [PATCH 06/84] Bump virtualenv from 20.1.0 to 20.2.1 Bumps [virtualenv](https://github.com/pypa/virtualenv) from 20.1.0 to 20.2.1. - [Release notes](https://github.com/pypa/virtualenv/releases) - [Changelog](https://github.com/pypa/virtualenv/blob/main/docs/changelog.rst) - [Commits](https://github.com/pypa/virtualenv/compare/20.1.0...20.2.1) Signed-off-by: dependabot[bot] --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4f3033a6..28393a6f 100644 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ "python-coveralls==2.9.3", "coverage==4.5.4", "mock==2.0.0", - "virtualenv==20.1.0", + "virtualenv==20.2.1", ], }, classifiers=[ From 219b41048f7e63d1d8146a35964f7dee08c2df66 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Mar 2021 12:03:09 +0000 Subject: [PATCH 07/84] Bump virtualenv from 20.2.1 to 20.4.3 Bumps [virtualenv](https://github.com/pypa/virtualenv) from 20.2.1 to 20.4.3. - [Release notes](https://github.com/pypa/virtualenv/releases) - [Changelog](https://github.com/pypa/virtualenv/blob/main/docs/changelog.rst) - [Commits](https://github.com/pypa/virtualenv/compare/20.2.1...20.4.3) Signed-off-by: dependabot[bot] --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 28393a6f..93bb0fa8 100644 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ "python-coveralls==2.9.3", "coverage==4.5.4", "mock==2.0.0", - "virtualenv==20.2.1", + "virtualenv==20.4.3", ], }, classifiers=[ From 2a51312d4b301e3e8792ee7bdc8d90a87b6e443f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Mar 2021 12:17:25 +0000 Subject: [PATCH 08/84] Bump pytz from 2020.4 to 2021.1 Bumps [pytz](https://github.com/stub42/pytz) from 2020.4 to 2021.1. - [Release notes](https://github.com/stub42/pytz/releases) - [Commits](https://github.com/stub42/pytz/compare/release_2020.4...release_2021.1) Signed-off-by: dependabot[bot] --- requirements.in | 2 +- requirements.txt | 72 ++++++++++++++++++++++++++++++++++-------------- setup.py | 2 +- 3 files changed, 53 insertions(+), 23 deletions(-) diff --git a/requirements.in b/requirements.in index 569f4af8..c65ea625 100644 --- a/requirements.in +++ b/requirements.in @@ -7,7 +7,7 @@ pbr==1.10.0 protobuf==3.14.0 pyopenssl==19.1.0 PyYAML==5.2 # PyYAML 5.3 does not support Python 3.4 -pytz==2020.4 +pytz==2021.1 requests>=2.20.0 urllib3>=1.24.3 deprecated==1.2.10 diff --git a/requirements.txt b/requirements.txt index 42201f80..614154d3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,24 +4,54 @@ # # pip-compile --output-file=requirements.txt requirements.in # -asn1==2.2.0 # via -r requirements.in -certifi==2018.11.29 # via requests -cffi==1.14.4 # via -r requirements.in, cryptography -chardet==3.0.4 # via requests -cryptography==2.8 # via -r requirements.in, pyopenssl -deprecated==1.2.10 # via -r requirements.in -future==0.18.2 # via -r requirements.in -idna==2.7 # via requests -iso8601==0.1.13 # via -r requirements.in -itsdangerous==1.1.0 # via -r requirements.in -pbr==1.10.0 # via -r requirements.in -protobuf==3.14.0 # via -r requirements.in -pycparser==2.18 # via cffi -pyopenssl==19.1.0 # via -r requirements.in -pytz==2020.4 # via -r requirements.in -pyyaml==5.2 # via -r requirements.in -requests==2.21.0 # via -r requirements.in -six==1.10.0 # via cryptography, protobuf, pyopenssl -urllib3==1.24.3 # via -r requirements.in, requests -wheel==0.33.6 # via -r requirements.in -wrapt==1.11.2 # via deprecated +asn1==2.2.0 + # via -r requirements.in +certifi==2018.11.29 + # via requests +cffi==1.14.4 + # via + # -r requirements.in + # cryptography +chardet==3.0.4 + # via requests +cryptography==2.8 + # via + # -r requirements.in + # pyopenssl +deprecated==1.2.10 + # via -r requirements.in +future==0.18.2 + # via -r requirements.in +idna==2.7 + # via requests +iso8601==0.1.13 + # via -r requirements.in +itsdangerous==1.1.0 + # via -r requirements.in +pbr==1.10.0 + # via -r requirements.in +protobuf==3.14.0 + # via -r requirements.in +pycparser==2.18 + # via cffi +pyopenssl==19.1.0 + # via -r requirements.in +pytz==2021.1 + # via -r requirements.in +pyyaml==5.2 + # via -r requirements.in +requests==2.21.0 + # via -r requirements.in +six==1.10.0 + # via + # cryptography + # protobuf + # pyopenssl +urllib3==1.24.3 + # via + # -r requirements.in + # requests +wheel==0.33.6 + # via -r requirements.in +wrapt==1.11.2 + # via deprecated diff --git a/setup.py b/setup.py index 93bb0fa8..413abafa 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ "asn1==2.2.0", "pyopenssl>=18.0.0", "iso8601==0.1.13", - "pytz==2020.4", + "pytz==2021.1", ], extras_require={ "examples": [ From 7e04b10f2e9b95a561a0421104edf09ff5d8527c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Mar 2021 12:26:28 +0000 Subject: [PATCH 09/84] Bump iso8601 from 0.1.13 to 0.1.14 Bumps [iso8601](https://github.com/micktwomey/pyiso8601) from 0.1.13 to 0.1.14. - [Release notes](https://github.com/micktwomey/pyiso8601/releases) - [Commits](https://github.com/micktwomey/pyiso8601/compare/0.1.13...0.1.14) Signed-off-by: dependabot[bot] --- requirements.in | 2 +- requirements.txt | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.in b/requirements.in index c65ea625..882d0016 100644 --- a/requirements.in +++ b/requirements.in @@ -12,4 +12,4 @@ requests>=2.20.0 urllib3>=1.24.3 deprecated==1.2.10 wheel==0.33.6 -iso8601==0.1.13 +iso8601==0.1.14 diff --git a/requirements.txt b/requirements.txt index 614154d3..3ae469a0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -24,7 +24,7 @@ future==0.18.2 # via -r requirements.in idna==2.7 # via requests -iso8601==0.1.13 +iso8601==0.1.14 # via -r requirements.in itsdangerous==1.1.0 # via -r requirements.in diff --git a/setup.py b/setup.py index 413abafa..e8f9f477 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ "future>=0.11.0", "asn1==2.2.0", "pyopenssl>=18.0.0", - "iso8601==0.1.13", + "iso8601==0.1.14", "pytz==2021.1", ], extras_require={ From fac56f2736d8be57071b408421ae436faf7de8f0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Mar 2021 12:36:17 +0000 Subject: [PATCH 10/84] Bump deprecated from 1.2.10 to 1.2.12 Bumps [deprecated](https://github.com/tantale/deprecated) from 1.2.10 to 1.2.12. - [Release notes](https://github.com/tantale/deprecated/releases) - [Changelog](https://github.com/tantale/deprecated/blob/master/CHANGELOG.rst) - [Commits](https://github.com/tantale/deprecated/compare/v1.2.10...v1.2.12) Signed-off-by: dependabot[bot] --- requirements.in | 2 +- requirements.txt | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.in b/requirements.in index 882d0016..e13ddd3e 100644 --- a/requirements.in +++ b/requirements.in @@ -10,6 +10,6 @@ PyYAML==5.2 # PyYAML 5.3 does not support Python 3.4 pytz==2021.1 requests>=2.20.0 urllib3>=1.24.3 -deprecated==1.2.10 +deprecated==1.2.12 wheel==0.33.6 iso8601==0.1.14 diff --git a/requirements.txt b/requirements.txt index 3ae469a0..b1a87b98 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,7 +18,7 @@ cryptography==2.8 # via # -r requirements.in # pyopenssl -deprecated==1.2.10 +deprecated==1.2.12 # via -r requirements.in future==0.18.2 # via -r requirements.in diff --git a/setup.py b/setup.py index e8f9f477..6f5f3796 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ author="Yoti", author_email="websdk@yoti.com", install_requires=[ - "deprecated==1.2.10", + "deprecated==1.2.12", "cryptography>=2.2.1", "protobuf>=3.1.0", "requests>=2.11.1", From cb493e94d3845d2acfe90a5e35da6c062554701f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Apr 2021 10:41:37 +0000 Subject: [PATCH 11/84] Bump protobuf from 3.14.0 to 3.15.8 Bumps [protobuf](https://github.com/protocolbuffers/protobuf) from 3.14.0 to 3.15.8. - [Release notes](https://github.com/protocolbuffers/protobuf/releases) - [Changelog](https://github.com/protocolbuffers/protobuf/blob/master/generate_changelog.py) - [Commits](https://github.com/protocolbuffers/protobuf/compare/v3.14.0...v3.15.8) Signed-off-by: dependabot[bot] --- requirements.in | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.in b/requirements.in index e13ddd3e..fb4576d3 100644 --- a/requirements.in +++ b/requirements.in @@ -4,7 +4,7 @@ cffi==1.14.4 future==0.18.2 itsdangerous==1.1.0 pbr==1.10.0 -protobuf==3.14.0 +protobuf==3.15.8 pyopenssl==19.1.0 PyYAML==5.2 # PyYAML 5.3 does not support Python 3.4 pytz==2021.1 diff --git a/requirements.txt b/requirements.txt index b1a87b98..8e71ce30 100644 --- a/requirements.txt +++ b/requirements.txt @@ -30,7 +30,7 @@ itsdangerous==1.1.0 # via -r requirements.in pbr==1.10.0 # via -r requirements.in -protobuf==3.14.0 +protobuf==3.15.8 # via -r requirements.in pycparser==2.18 # via cffi From 9d7b92b60f68f02f0acf6f02e0a060a7b4d8277c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 15 Apr 2021 09:36:16 +0000 Subject: [PATCH 12/84] Bump cffi from 1.14.4 to 1.14.5 Bumps [cffi](https://github.com/python-cffi/release-doc) from 1.14.4 to 1.14.5. - [Release notes](https://github.com/python-cffi/release-doc/releases) - [Commits](https://github.com/python-cffi/release-doc/commits) Signed-off-by: dependabot[bot] --- requirements.in | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.in b/requirements.in index fb4576d3..128083db 100644 --- a/requirements.in +++ b/requirements.in @@ -1,6 +1,6 @@ asn1==2.2.0 # asn1 2.3.0 introduces enum34 as a dependency, which causes problems on some envs cryptography==2.8.0 -cffi==1.14.4 +cffi==1.14.5 future==0.18.2 itsdangerous==1.1.0 pbr==1.10.0 diff --git a/requirements.txt b/requirements.txt index 8e71ce30..c37af6e0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,7 @@ asn1==2.2.0 # via -r requirements.in certifi==2018.11.29 # via requests -cffi==1.14.4 +cffi==1.14.5 # via # -r requirements.in # cryptography From 9b27c92d111569139c9dc108af4bf8ff91b831fa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Jun 2021 05:09:47 +0000 Subject: [PATCH 13/84] Bump protobuf from 3.15.8 to 3.17.1 Bumps [protobuf](https://github.com/protocolbuffers/protobuf) from 3.15.8 to 3.17.1. - [Release notes](https://github.com/protocolbuffers/protobuf/releases) - [Changelog](https://github.com/protocolbuffers/protobuf/blob/master/generate_changelog.py) - [Commits](https://github.com/protocolbuffers/protobuf/compare/v3.15.8...v3.17.1) Signed-off-by: dependabot[bot] --- requirements.in | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.in b/requirements.in index 128083db..4d543b4f 100644 --- a/requirements.in +++ b/requirements.in @@ -4,7 +4,7 @@ cffi==1.14.5 future==0.18.2 itsdangerous==1.1.0 pbr==1.10.0 -protobuf==3.15.8 +protobuf==3.17.1 pyopenssl==19.1.0 PyYAML==5.2 # PyYAML 5.3 does not support Python 3.4 pytz==2021.1 diff --git a/requirements.txt b/requirements.txt index c37af6e0..75f6d4b1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -30,7 +30,7 @@ itsdangerous==1.1.0 # via -r requirements.in pbr==1.10.0 # via -r requirements.in -protobuf==3.15.8 +protobuf==3.17.1 # via -r requirements.in pycparser==2.18 # via cffi From ae48f84c92ca4b4f890e8815d8c584700a65ebc7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Jun 2021 05:09:22 +0000 Subject: [PATCH 14/84] Bump werkzeug from 1.0.1 to 2.0.1 Bumps [werkzeug](https://github.com/pallets/werkzeug) from 1.0.1 to 2.0.1. - [Release notes](https://github.com/pallets/werkzeug/releases) - [Changelog](https://github.com/pallets/werkzeug/blob/main/CHANGES.rst) - [Commits](https://github.com/pallets/werkzeug/compare/1.0.1...2.0.1) Signed-off-by: dependabot[bot] --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 6f5f3796..f39f0203 100644 --- a/setup.py +++ b/setup.py @@ -34,7 +34,7 @@ "Flask>=1.0.4", "python-dotenv>=0.7.1", "django-sslserver>=0.22.0", - "Werkzeug==1.0.1", + "Werkzeug==2.0.1", ], "dev": [ "pre-commit==1.17.0", From 1d21b3bd40becf4d4ee1fa6802d8aa442cb423a0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Jun 2021 05:09:26 +0000 Subject: [PATCH 15/84] Bump virtualenv from 20.4.3 to 20.4.7 Bumps [virtualenv](https://github.com/pypa/virtualenv) from 20.4.3 to 20.4.7. - [Release notes](https://github.com/pypa/virtualenv/releases) - [Changelog](https://github.com/pypa/virtualenv/blob/main/docs/changelog.rst) - [Commits](https://github.com/pypa/virtualenv/compare/20.4.3...20.4.7) Signed-off-by: dependabot[bot] --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index f39f0203..bb3620b1 100644 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ "python-coveralls==2.9.3", "coverage==4.5.4", "mock==2.0.0", - "virtualenv==20.4.3", + "virtualenv==20.4.7", ], }, classifiers=[ From c1d7f9c6caecff6fd791f9fc0d58f6d79645187e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Jul 2021 04:02:20 +0000 Subject: [PATCH 16/84] Bump protobuf from 3.17.1 to 3.17.3 Bumps [protobuf](https://github.com/protocolbuffers/protobuf) from 3.17.1 to 3.17.3. - [Release notes](https://github.com/protocolbuffers/protobuf/releases) - [Changelog](https://github.com/protocolbuffers/protobuf/blob/master/generate_changelog.py) - [Commits](https://github.com/protocolbuffers/protobuf/compare/v3.17.1...v3.17.3) --- updated-dependencies: - dependency-name: protobuf dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.in | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.in b/requirements.in index 4d543b4f..fbb5f151 100644 --- a/requirements.in +++ b/requirements.in @@ -4,7 +4,7 @@ cffi==1.14.5 future==0.18.2 itsdangerous==1.1.0 pbr==1.10.0 -protobuf==3.17.1 +protobuf==3.17.3 pyopenssl==19.1.0 PyYAML==5.2 # PyYAML 5.3 does not support Python 3.4 pytz==2021.1 diff --git a/requirements.txt b/requirements.txt index 75f6d4b1..6f9c93cf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -30,7 +30,7 @@ itsdangerous==1.1.0 # via -r requirements.in pbr==1.10.0 # via -r requirements.in -protobuf==3.17.1 +protobuf==3.17.3 # via -r requirements.in pycparser==2.18 # via cffi From 885c7c68db7c5582a4889bbf3a6ec83635c4a908 Mon Sep 17 00:00:00 2001 From: Michal Milewicz Date: Fri, 9 Jul 2021 11:01:37 +0200 Subject: [PATCH 17/84] adding myself to dependabot --- .github/dependabot.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index e7036d6d..7223e919 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -11,3 +11,4 @@ updates: - gautam-yoti assignees: - echarrod + - michalmilewiczyoti From 0691db9625545d9f7430ba016177e2c3c9aa363b Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Wed, 4 Aug 2021 16:50:14 +0100 Subject: [PATCH 18/84] Apply suggestions from code review --- .github/dependabot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 7223e919..ec60e657 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,6 +9,6 @@ updates: reviewers: - echarrod - gautam-yoti + - michalmilewiczyoti assignees: - - echarrod - michalmilewiczyoti From 6cab71ff01bad7ad7ea983f273752f4c4aaee708 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Sep 2021 04:00:50 +0000 Subject: [PATCH 19/84] Bump virtualenv from 20.4.7 to 20.7.2 Bumps [virtualenv](https://github.com/pypa/virtualenv) from 20.4.7 to 20.7.2. - [Release notes](https://github.com/pypa/virtualenv/releases) - [Changelog](https://github.com/pypa/virtualenv/blob/main/docs/changelog.rst) - [Commits](https://github.com/pypa/virtualenv/compare/20.4.7...20.7.2) --- updated-dependencies: - dependency-name: virtualenv dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index bb3620b1..5609d43b 100644 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ "python-coveralls==2.9.3", "coverage==4.5.4", "mock==2.0.0", - "virtualenv==20.4.7", + "virtualenv==20.7.2", ], }, classifiers=[ From 22907cbe8a901e260a01de6b5d557a857b619e70 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 Sep 2021 12:19:03 +0000 Subject: [PATCH 20/84] Bump cffi from 1.14.5 to 1.14.6 Bumps [cffi](http://cffi.readthedocs.org) from 1.14.5 to 1.14.6. --- updated-dependencies: - dependency-name: cffi dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.in | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.in b/requirements.in index fbb5f151..bf5c44ab 100644 --- a/requirements.in +++ b/requirements.in @@ -1,6 +1,6 @@ asn1==2.2.0 # asn1 2.3.0 introduces enum34 as a dependency, which causes problems on some envs cryptography==2.8.0 -cffi==1.14.5 +cffi==1.14.6 future==0.18.2 itsdangerous==1.1.0 pbr==1.10.0 diff --git a/requirements.txt b/requirements.txt index 6f9c93cf..02769ed1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,7 @@ asn1==2.2.0 # via -r requirements.in certifi==2018.11.29 # via requests -cffi==1.14.5 +cffi==1.14.6 # via # -r requirements.in # cryptography From 3edba3f2d5b0740eb44acc1046471ce59cb6412c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 Sep 2021 16:19:29 +0000 Subject: [PATCH 21/84] Bump iso8601 from 0.1.14 to 0.1.16 Bumps [iso8601](https://github.com/micktwomey/pyiso8601) from 0.1.14 to 0.1.16. - [Release notes](https://github.com/micktwomey/pyiso8601/releases) - [Commits](https://github.com/micktwomey/pyiso8601/compare/0.1.14...0.1.16) --- updated-dependencies: - dependency-name: iso8601 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.in | 2 +- requirements.txt | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.in b/requirements.in index bf5c44ab..3783b6d4 100644 --- a/requirements.in +++ b/requirements.in @@ -12,4 +12,4 @@ requests>=2.20.0 urllib3>=1.24.3 deprecated==1.2.12 wheel==0.33.6 -iso8601==0.1.14 +iso8601==0.1.16 diff --git a/requirements.txt b/requirements.txt index 02769ed1..9ce9d685 100644 --- a/requirements.txt +++ b/requirements.txt @@ -24,7 +24,7 @@ future==0.18.2 # via -r requirements.in idna==2.7 # via requests -iso8601==0.1.14 +iso8601==0.1.16 # via -r requirements.in itsdangerous==1.1.0 # via -r requirements.in diff --git a/setup.py b/setup.py index 5609d43b..aec51a84 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ "future>=0.11.0", "asn1==2.2.0", "pyopenssl>=18.0.0", - "iso8601==0.1.14", + "iso8601==0.1.16", "pytz==2021.1", ], extras_require={ From afedb393424f617f8df3c53719ad9b935a97d428 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Oct 2021 04:02:21 +0000 Subject: [PATCH 22/84] Bump virtualenv from 20.7.2 to 20.8.1 Bumps [virtualenv](https://github.com/pypa/virtualenv) from 20.7.2 to 20.8.1. - [Release notes](https://github.com/pypa/virtualenv/releases) - [Changelog](https://github.com/pypa/virtualenv/blob/main/docs/changelog.rst) - [Commits](https://github.com/pypa/virtualenv/compare/20.7.2...20.8.1) --- updated-dependencies: - dependency-name: virtualenv dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index aec51a84..50502a8e 100644 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ "python-coveralls==2.9.3", "coverage==4.5.4", "mock==2.0.0", - "virtualenv==20.7.2", + "virtualenv==20.8.1", ], }, classifiers=[ From 7950d4bc52bc28cef2718ca9c6e57a6b3bcfd049 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Oct 2021 04:01:54 +0000 Subject: [PATCH 23/84] Bump deprecated from 1.2.12 to 1.2.13 Bumps [deprecated](https://github.com/tantale/deprecated) from 1.2.12 to 1.2.13. - [Release notes](https://github.com/tantale/deprecated/releases) - [Changelog](https://github.com/tantale/deprecated/blob/master/CHANGELOG.rst) - [Commits](https://github.com/tantale/deprecated/compare/v1.2.12...v1.2.13) --- updated-dependencies: - dependency-name: deprecated dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.in | 2 +- requirements.txt | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.in b/requirements.in index 3783b6d4..6dcdc67e 100644 --- a/requirements.in +++ b/requirements.in @@ -10,6 +10,6 @@ PyYAML==5.2 # PyYAML 5.3 does not support Python 3.4 pytz==2021.1 requests>=2.20.0 urllib3>=1.24.3 -deprecated==1.2.12 +deprecated==1.2.13 wheel==0.33.6 iso8601==0.1.16 diff --git a/requirements.txt b/requirements.txt index 9ce9d685..aeef4920 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,7 +18,7 @@ cryptography==2.8 # via # -r requirements.in # pyopenssl -deprecated==1.2.12 +deprecated==1.2.13 # via -r requirements.in future==0.18.2 # via -r requirements.in diff --git a/setup.py b/setup.py index 50502a8e..9ddc4faa 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ author="Yoti", author_email="websdk@yoti.com", install_requires=[ - "deprecated==1.2.12", + "deprecated==1.2.13", "cryptography>=2.2.1", "protobuf>=3.1.0", "requests>=2.11.1", From c0bfbdb6c2b2accb829c3d1b77f8792b7cb4df64 Mon Sep 17 00:00:00 2001 From: echarrod Date: Thu, 21 Oct 2021 10:30:41 +0100 Subject: [PATCH 24/84] Update supported Python versions: add later versions and remove 2.7 --- .github/workflows/tests.yaml | 2 +- setup.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index ff260478..7ae1b7a7 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [2.7, 3.6, 3.7, 3.8, 3.9, "3.10-dev"] + python-version: [3.6, 3.7, 3.8, 3.9, 3.10, "3.11-dev"] steps: - uses: actions/checkout@v2 diff --git a/setup.py b/setup.py index 9ddc4faa..60a2381f 100644 --- a/setup.py +++ b/setup.py @@ -46,6 +46,7 @@ "coverage==4.5.4", "mock==2.0.0", "virtualenv==20.8.1", + "flake8==4.0.1", ], }, classifiers=[ @@ -54,13 +55,12 @@ "Operating System :: OS Independent", "Intended Audience :: Developers", "Programming Language :: Python", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.4", - "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "Topic :: Software Development :: Libraries :: Python Modules", ], keywords="yoti sdk 2FA multifactor authentication verification identity login register verify 2Factor", From 91bb167b9f941d99b6b71167adc4ef4471ac2dc2 Mon Sep 17 00:00:00 2001 From: echarrod Date: Thu, 21 Oct 2021 10:31:04 +0100 Subject: [PATCH 25/84] Update pre-commit, use specific versions rather than floating branch --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6ed7baf9..d702e8d7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ exclude: protobuf/ repos: - repo: https://github.com/ambv/black - rev: stable + rev: 847d468b828faff7daae297d8a20d899d2259824 hooks: - id: black - repo: https://github.com/pre-commit/pre-commit-hooks From aa9e1620fa3f68066b2097c4bde8bbaedd3394fd Mon Sep 17 00:00:00 2001 From: echarrod Date: Thu, 21 Oct 2021 10:49:33 +0100 Subject: [PATCH 26/84] Remove travis, update references to point to Github workflow --- .travis.yml | 77 ------------------------------------------------- CONTRIBUTING.md | 2 +- README.md | 2 +- 3 files changed, 2 insertions(+), 79 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 180a9b1f..00000000 --- a/.travis.yml +++ /dev/null @@ -1,77 +0,0 @@ -language: python - -dist: xenial - -git: - depth: 3 - -jobs: - allow_failures: - - python: "3.8-dev" - include: - - &test - stage: Test - python: "2.7" - cache: pip - before_install: - - pip install -U setuptools - install: - - pip install -r requirements.txt - - pip install -e .[dev] - script: - - pytest -v - - <<: *test - python: "3.4" - - <<: *test - python: "3.5" - - <<: *test - python: "3.5-dev" - - <<: *test - python: "3.6" - - <<: *test - python: "3.6-dev" - - <<: *test - python: "3.7" - - <<: *test - python: "3.7-dev" - - <<: *test - python: "3.8-dev" - - <<: *test - python: "3.8" - - - stage: Check Examples - name: AML - python: "3.8" - script: - - cd ./examples/aml - - pip install -r requirements.txt - - name: Django - python: "3.8" - script: - - cd ./examples/yoti_example_django - - pip install -r requirements.txt - - name: Flask - python: "3.8" - script: - - cd ./examples/yoti_example_flask - - pip install -r requirements.txt - - name: Doc Scan - python: "3.8" - script: - - cd ./examples/doc_scan - - pip install -r requirements.txt - - - stage: Analyze - name: Sonarcloud - python: "3.8" - addons: - sonarcloud: - organization: "getyoti" - install: - - pip install -r requirements.txt - - pip install -e .[dev] - script: - - pytest --cov=yoti_python_sdk yoti_python_sdk/tests --cov-report=xml:coverage-reports/coverage-new.xml - - sed -i 's+.*+/home/travis/build/getyoti/yoti-python-sdk/yoti_python_sdk+g' coverage-reports/coverage-new.xml - - sonar-scanner - if: type = pull_request OR branch = master diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 86e2f477..51e32699 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,7 +7,7 @@ ## Adding Features Any features added must be fully tested and documented, with examples supplied in the pull request. -The feature must support the lowest Python version that the SDK supports (see [the travis file](.travis.yml) for all supported versions). The feature +The feature must support the lowest Python version that the SDK supports (see [the GitHub workflow tests file](./.github/workflows/tests.yaml) for all supported versions). The feature must not introduce any unnecessary dependencies (although introducing a new third party library is open for discussion if absolutely required). diff --git a/README.md b/README.md index 1014886c..d50a9736 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ Yoti also allows you to enable user details verification from your mobile app by ## Requirements -To see the versions of Python this SDK is compatible with, see the [.travis.yml](/.travis.yml) file. +To see the versions of Python this SDK is compatible with, see the [the GitHub workflow tests file](./.github/workflows/tests.yaml) file. ## Installing the SDK From 2335e35466f2abaf2d1615c44129438ef47d0407 Mon Sep 17 00:00:00 2001 From: echarrod Date: Thu, 21 Oct 2021 11:39:44 +0100 Subject: [PATCH 27/84] Update itsdangerous after incompatibility --- requirements.in | 2 +- requirements.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.in b/requirements.in index 6dcdc67e..23d83903 100644 --- a/requirements.in +++ b/requirements.in @@ -2,7 +2,7 @@ asn1==2.2.0 # asn1 2.3.0 introduces enum34 as a dependency, which causes problem cryptography==2.8.0 cffi==1.14.6 future==0.18.2 -itsdangerous==1.1.0 +itsdangerous==2.0.1 pbr==1.10.0 protobuf==3.17.3 pyopenssl==19.1.0 diff --git a/requirements.txt b/requirements.txt index aeef4920..d8194de7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile +# This file is autogenerated by pip-compile with python 3.8 # To update, run: # # pip-compile --output-file=requirements.txt requirements.in @@ -26,7 +26,7 @@ idna==2.7 # via requests iso8601==0.1.16 # via -r requirements.in -itsdangerous==1.1.0 +itsdangerous==2.0.1 # via -r requirements.in pbr==1.10.0 # via -r requirements.in From 6bd37fd99db5c2843cd817e9fe76762be0112ef9 Mon Sep 17 00:00:00 2001 From: echarrod Date: Thu, 21 Oct 2021 11:40:10 +0100 Subject: [PATCH 28/84] Fix pre-commit violations --- .../test_third_party_attribute_extension.py | 15 ++++++++++++--- yoti_python_sdk/tests/test_activity_details.py | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/yoti_python_sdk/tests/dynamic_sharing_service/extension/test_third_party_attribute_extension.py b/yoti_python_sdk/tests/dynamic_sharing_service/extension/test_third_party_attribute_extension.py index 7c7a57ae..1bf054ba 100644 --- a/yoti_python_sdk/tests/dynamic_sharing_service/extension/test_third_party_attribute_extension.py +++ b/yoti_python_sdk/tests/dynamic_sharing_service/extension/test_third_party_attribute_extension.py @@ -117,9 +117,18 @@ def test_should_format_utc_expiry_dates_correctly(expiry_date, expected_value): @pytest.mark.parametrize( "expiry_date, tz_name", [ - (datetime(2030, 6, 6, 8, 0, 0, 0), "US/Eastern",), - (datetime(2030, 6, 6, 15, 0, 0, 0), "Europe/Moscow",), - (datetime(2030, 6, 6, 7, 0, 0, 0), "America/Jamaica",), + ( + datetime(2030, 6, 6, 8, 0, 0, 0), + "US/Eastern", + ), + ( + datetime(2030, 6, 6, 15, 0, 0, 0), + "Europe/Moscow", + ), + ( + datetime(2030, 6, 6, 7, 0, 0, 0), + "America/Jamaica", + ), (datetime(2030, 6, 6, 23, 0, 0, 0), "Etc/GMT-11"), (datetime(2030, 6, 6, 7, 0, 0, 0), "Etc/GMT+5"), # In order to conform with the POSIX style, those zones beginning diff --git a/yoti_python_sdk/tests/test_activity_details.py b/yoti_python_sdk/tests/test_activity_details.py index 1735b030..1fc349f1 100644 --- a/yoti_python_sdk/tests/test_activity_details.py +++ b/yoti_python_sdk/tests/test_activity_details.py @@ -85,7 +85,7 @@ def create_age_verified_field( ): activity_details.field = lambda: None activity_details.field.name = ( - "age_over:{0}".format(age) if over is True else "age_under:".format(age) + "age_over:{0}".format(age) if over is True else "age_under:{0}".format(age) ) activity_details.field.value = encoded_string_verified_value activity_details.field.content_type = Protobuf.CT_STRING From 818e0732e4fe3177e73035ee708fd6059b66596c Mon Sep 17 00:00:00 2001 From: echarrod Date: Thu, 21 Oct 2021 12:16:01 +0100 Subject: [PATCH 29/84] Use Python 3.9 for examples, install distutils --- .github/workflows/tests.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 7ae1b7a7..f2384922 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.6, 3.7, 3.8, 3.9, 3.10, "3.11-dev"] + python-version: [3.6, 3.7, 3.8, 3.9, "3.10"] steps: - uses: actions/checkout@v2 @@ -41,9 +41,13 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2.1.4 + with: + python-version: 3.9 - run: pip install -U setuptools==45 + - run: sudo apt install python3-distutils -y + - run: pushd examples/aml && pip install -r requirements.txt && popd - run: pushd examples/yoti_example_django && pip install -r requirements.txt && popd From bf7d59c05dad4b0c1bb9f19a1f1ae4bfe79295dd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 21 Oct 2021 11:48:54 +0000 Subject: [PATCH 30/84] Bump protobuf from 3.17.3 to 3.19.0 Bumps [protobuf](https://github.com/protocolbuffers/protobuf) from 3.17.3 to 3.19.0. - [Release notes](https://github.com/protocolbuffers/protobuf/releases) - [Changelog](https://github.com/protocolbuffers/protobuf/blob/master/generate_changelog.py) - [Commits](https://github.com/protocolbuffers/protobuf/compare/v3.17.3...v3.19.0) --- updated-dependencies: - dependency-name: protobuf dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.in | 2 +- requirements.txt | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/requirements.in b/requirements.in index 23d83903..9d7e6792 100644 --- a/requirements.in +++ b/requirements.in @@ -4,7 +4,7 @@ cffi==1.14.6 future==0.18.2 itsdangerous==2.0.1 pbr==1.10.0 -protobuf==3.17.3 +protobuf==3.19.0 pyopenssl==19.1.0 PyYAML==5.2 # PyYAML 5.3 does not support Python 3.4 pytz==2021.1 diff --git a/requirements.txt b/requirements.txt index d8194de7..b7aed536 100644 --- a/requirements.txt +++ b/requirements.txt @@ -30,7 +30,7 @@ itsdangerous==2.0.1 # via -r requirements.in pbr==1.10.0 # via -r requirements.in -protobuf==3.17.3 +protobuf==3.19.0 # via -r requirements.in pycparser==2.18 # via cffi @@ -45,7 +45,6 @@ requests==2.21.0 six==1.10.0 # via # cryptography - # protobuf # pyopenssl urllib3==1.24.3 # via From a0887d8828ec191cfe06784a2a6e1ab4bc9f9455 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Nov 2021 04:00:37 +0000 Subject: [PATCH 31/84] Bump werkzeug from 2.0.1 to 2.0.2 Bumps [werkzeug](https://github.com/pallets/werkzeug) from 2.0.1 to 2.0.2. - [Release notes](https://github.com/pallets/werkzeug/releases) - [Changelog](https://github.com/pallets/werkzeug/blob/main/CHANGES.rst) - [Commits](https://github.com/pallets/werkzeug/compare/2.0.1...2.0.2) --- updated-dependencies: - dependency-name: werkzeug dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 60a2381f..b3a102a7 100644 --- a/setup.py +++ b/setup.py @@ -34,7 +34,7 @@ "Flask>=1.0.4", "python-dotenv>=0.7.1", "django-sslserver>=0.22.0", - "Werkzeug==2.0.1", + "Werkzeug==2.0.2", ], "dev": [ "pre-commit==1.17.0", From 767a8ad177c662f8040b9381d83e551894791d18 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Nov 2021 04:01:15 +0000 Subject: [PATCH 32/84] Bump pytz from 2021.1 to 2021.3 Bumps [pytz](https://github.com/stub42/pytz) from 2021.1 to 2021.3. - [Release notes](https://github.com/stub42/pytz/releases) - [Commits](https://github.com/stub42/pytz/compare/release_2021.1...release_2021.3) --- updated-dependencies: - dependency-name: pytz dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.in | 2 +- requirements.txt | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.in b/requirements.in index 9d7e6792..c0b07b66 100644 --- a/requirements.in +++ b/requirements.in @@ -7,7 +7,7 @@ pbr==1.10.0 protobuf==3.19.0 pyopenssl==19.1.0 PyYAML==5.2 # PyYAML 5.3 does not support Python 3.4 -pytz==2021.1 +pytz==2021.3 requests>=2.20.0 urllib3>=1.24.3 deprecated==1.2.13 diff --git a/requirements.txt b/requirements.txt index b7aed536..d3a836c9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -36,7 +36,7 @@ pycparser==2.18 # via cffi pyopenssl==19.1.0 # via -r requirements.in -pytz==2021.1 +pytz==2021.3 # via -r requirements.in pyyaml==5.2 # via -r requirements.in diff --git a/setup.py b/setup.py index b3a102a7..9acc8b0c 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ "asn1==2.2.0", "pyopenssl>=18.0.0", "iso8601==0.1.16", - "pytz==2021.1", + "pytz==2021.3", ], extras_require={ "examples": [ From fcf93bbef654aa825c8588f68adb3b1779909766 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Nov 2021 14:27:46 +0000 Subject: [PATCH 33/84] Bump protobuf from 3.19.0 to 3.19.1 Bumps [protobuf](https://github.com/protocolbuffers/protobuf) from 3.19.0 to 3.19.1. - [Release notes](https://github.com/protocolbuffers/protobuf/releases) - [Changelog](https://github.com/protocolbuffers/protobuf/blob/master/generate_changelog.py) - [Commits](https://github.com/protocolbuffers/protobuf/compare/v3.19.0...v3.19.1) --- updated-dependencies: - dependency-name: protobuf dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.in | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.in b/requirements.in index c0b07b66..e40b35ec 100644 --- a/requirements.in +++ b/requirements.in @@ -4,7 +4,7 @@ cffi==1.14.6 future==0.18.2 itsdangerous==2.0.1 pbr==1.10.0 -protobuf==3.19.0 +protobuf==3.19.1 pyopenssl==19.1.0 PyYAML==5.2 # PyYAML 5.3 does not support Python 3.4 pytz==2021.3 diff --git a/requirements.txt b/requirements.txt index d3a836c9..49e03d51 100644 --- a/requirements.txt +++ b/requirements.txt @@ -30,7 +30,7 @@ itsdangerous==2.0.1 # via -r requirements.in pbr==1.10.0 # via -r requirements.in -protobuf==3.19.0 +protobuf==3.19.1 # via -r requirements.in pycparser==2.18 # via cffi From 1a7a0a01a5f983c0e869d8adfcd930dbdf0bc405 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Nov 2021 14:43:09 +0000 Subject: [PATCH 34/84] Bump cffi from 1.14.6 to 1.15.0 Bumps [cffi](http://cffi.readthedocs.org) from 1.14.6 to 1.15.0. --- updated-dependencies: - dependency-name: cffi dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.in | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.in b/requirements.in index e40b35ec..9fcc7209 100644 --- a/requirements.in +++ b/requirements.in @@ -1,6 +1,6 @@ asn1==2.2.0 # asn1 2.3.0 introduces enum34 as a dependency, which causes problems on some envs cryptography==2.8.0 -cffi==1.14.6 +cffi==1.15.0 future==0.18.2 itsdangerous==2.0.1 pbr==1.10.0 diff --git a/requirements.txt b/requirements.txt index 49e03d51..2d8a6d06 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,7 @@ asn1==2.2.0 # via -r requirements.in certifi==2018.11.29 # via requests -cffi==1.14.6 +cffi==1.15.0 # via # -r requirements.in # cryptography From c8562d7d349a0585a6bf3724980f377b0f5dc792 Mon Sep 17 00:00:00 2001 From: Michal Milewicz Date: Fri, 29 Oct 2021 10:01:04 +0200 Subject: [PATCH 35/84] [SDK-1998] adding handoff flag --- .gitignore | 1 + .../doc_scan/session/create/sdk_config.py | 29 +++++++++++++++++++ .../session/create/test_sdk_config.py | 12 ++++++++ yoti_python_sdk/tests/test_anchor.py | 11 ++++--- 4 files changed, 49 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 8a197872..1cd6cf41 100644 --- a/.gitignore +++ b/.gitignore @@ -105,3 +105,4 @@ examples/yoti_example_django/*.pem examples/yoti_example_flask/*.pem .scannerwork +.venv/ \ No newline at end of file diff --git a/yoti_python_sdk/doc_scan/session/create/sdk_config.py b/yoti_python_sdk/doc_scan/session/create/sdk_config.py index a1427e43..37cde6b5 100644 --- a/yoti_python_sdk/doc_scan/session/create/sdk_config.py +++ b/yoti_python_sdk/doc_scan/session/create/sdk_config.py @@ -21,6 +21,7 @@ def __init__( preset_issuing_country, success_url, error_url, + allow_handoff=None, privacy_policy_url=None, ): """ @@ -42,6 +43,8 @@ def __init__( :type error_url: str :param privacy_policy_url: the privacy policy url :type privacy_policy_url: str + :param allow_handoff: boolean flag for allow_handoff + :type allow_handoff: bool """ self.__allowed_capture_methods = allowed_capture_methods self.__primary_colour = primary_colour @@ -52,6 +55,7 @@ def __init__( self.__success_url = success_url self.__error_url = error_url self.__privacy_policy_url = privacy_policy_url + self.__allow_handoff = allow_handoff @property def allowed_capture_methods(self): @@ -134,6 +138,16 @@ def privacy_policy_url(self): """ return self.__privacy_policy_url + @property + def allow_handoff(self): + """ + Flag to enable/disable relying business to handoff + support when creating a session. + + :return: the allow_handoff + """ + return self.__allow_handoff + def to_json(self): return remove_null_values( { @@ -146,6 +160,7 @@ def to_json(self): "success_url": self.success_url, "error_url": self.error_url, "privacy_policy_url": self.privacy_policy_url, + "allow_handoff": self.allow_handoff, } ) @@ -165,6 +180,7 @@ def __init__(self): self.__success_url = None self.__error_url = None self.__privacy_policy_url = None + self.__allow_handoff = None def with_allowed_capture_methods(self, allowed_capture_methods): """ @@ -292,6 +308,18 @@ def with_privacy_policy_url(self, url): self.__privacy_policy_url = url return self + def with_allow_handoff(self, flag): + """ + Sets the allow handoff flag + + :param flag: boolean value for flag + :type flag: bool + :return: the builder + :rtype: SdkConfigBuilder + """ + self.__allow_handoff = flag + return self + def build(self): return SdkConfig( self.__allowed_capture_methods, @@ -302,5 +330,6 @@ def build(self): self.__preset_issuing_country, self.__success_url, self.__error_url, + self.__allow_handoff, self.__privacy_policy_url, ) diff --git a/yoti_python_sdk/tests/doc_scan/session/create/test_sdk_config.py b/yoti_python_sdk/tests/doc_scan/session/create/test_sdk_config.py index 68d2eafe..e1128767 100644 --- a/yoti_python_sdk/tests/doc_scan/session/create/test_sdk_config.py +++ b/yoti_python_sdk/tests/doc_scan/session/create/test_sdk_config.py @@ -15,6 +15,7 @@ class SdkConfigTest(unittest.TestCase): SOME_SUCCESS_URL = "https://mysite.com/yoti/success" SOME_ERROR_URL = "https://mysite.com/yoti/error" SOME_PRIVACY_POLICY_URL = "https://mysite.com/privacy" + SOME_ALLOW_HANDOFF = True def test_should_build_correctly(self): result = ( @@ -28,6 +29,7 @@ def test_should_build_correctly(self): .with_success_url(self.SOME_SUCCESS_URL) .with_error_url(self.SOME_ERROR_URL) .with_privacy_policy_url(self.SOME_PRIVACY_POLICY_URL) + .with_allow_handoff(self.SOME_ALLOW_HANDOFF) .build() ) @@ -47,6 +49,16 @@ def test_should_allows_camera(self): assert result.allowed_capture_methods == "CAMERA" + def test_not_passing_allow_handoff(self): + result = SdkConfigBuilder().with_allows_camera().build() + + assert result.allow_handoff is None + + def test_passing_allow_handoff_false_value(self): + result = SdkConfigBuilder().with_allow_handoff(False).build() + + assert result.allow_handoff is False + def test_should_serialize_to_json_without_error(self): result = ( SdkConfigBuilder() diff --git a/yoti_python_sdk/tests/test_anchor.py b/yoti_python_sdk/tests/test_anchor.py index 0adf48aa..59729c5e 100644 --- a/yoti_python_sdk/tests/test_anchor.py +++ b/yoti_python_sdk/tests/test_anchor.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- import logging +import pytz import time from datetime import datetime -from yoti_python_sdk.protobuf.attribute_public_api import Attribute_pb2 - import yoti_python_sdk from yoti_python_sdk import config from yoti_python_sdk.anchor import Anchor +from yoti_python_sdk.protobuf.attribute_public_api import Attribute_pb2 from yoti_python_sdk.tests import anchor_fixture_parser @@ -119,9 +119,12 @@ def test_processing_unknown_anchor_data(): ] expected_timestamp = datetime(2019, 3, 5, 10, 45, 11, 840037) - actual_timestamp = anchors[0].signed_timestamp + actual_timestamp = anchors[0].signed_timestamp.astimezone(pytz.utc) + + test_datetime_format = "%Y-%m-%d %H:%M:%S" - assert expected_timestamp == actual_timestamp + assert expected_timestamp.strftime(test_datetime_format) == \ + actual_timestamp.strftime(test_datetime_format) assert "document-registration-server" in [ a.value for a in anchors[0].origin_server_certs.issuer From 2f88484b05dd96aef2b2992a32493f6592228f82 Mon Sep 17 00:00:00 2001 From: Michal Milewicz Date: Fri, 5 Nov 2021 10:08:54 +0100 Subject: [PATCH 36/84] [SDK-1998] code review fixies --- yoti_python_sdk/tests/test_anchor.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/yoti_python_sdk/tests/test_anchor.py b/yoti_python_sdk/tests/test_anchor.py index 59729c5e..972412c9 100644 --- a/yoti_python_sdk/tests/test_anchor.py +++ b/yoti_python_sdk/tests/test_anchor.py @@ -118,13 +118,10 @@ def test_processing_unknown_anchor_data(): (anchor.value, anchor.anchor_type, anchor.sub_type) for anchor in anchors ] - expected_timestamp = datetime(2019, 3, 5, 10, 45, 11, 840037) - actual_timestamp = anchors[0].signed_timestamp.astimezone(pytz.utc) + expected_timestamp = datetime(2019, 3, 5, 10, 45, 11, 840037).replace(tzinfo=None) + actual_timestamp = anchors[0].signed_timestamp.astimezone(pytz.utc).replace(tzinfo=None) - test_datetime_format = "%Y-%m-%d %H:%M:%S" - - assert expected_timestamp.strftime(test_datetime_format) == \ - actual_timestamp.strftime(test_datetime_format) + assert expected_timestamp == actual_timestamp assert "document-registration-server" in [ a.value for a in anchors[0].origin_server_certs.issuer From 383864735e4c96a94bc24a241d6052b30668b23b Mon Sep 17 00:00:00 2001 From: Michal Milewicz Date: Fri, 5 Nov 2021 13:17:10 +0100 Subject: [PATCH 37/84] fixing test --- yoti_python_sdk/tests/doc_scan/session/create/test_sdk_config.py | 1 + 1 file changed, 1 insertion(+) diff --git a/yoti_python_sdk/tests/doc_scan/session/create/test_sdk_config.py b/yoti_python_sdk/tests/doc_scan/session/create/test_sdk_config.py index e1128767..d621a441 100644 --- a/yoti_python_sdk/tests/doc_scan/session/create/test_sdk_config.py +++ b/yoti_python_sdk/tests/doc_scan/session/create/test_sdk_config.py @@ -43,6 +43,7 @@ def test_should_build_correctly(self): assert result.success_url is self.SOME_SUCCESS_URL assert result.error_url is self.SOME_ERROR_URL assert result.privacy_policy_url is self.SOME_PRIVACY_POLICY_URL + assert result.allow_handoff is True def test_should_allows_camera(self): result = SdkConfigBuilder().with_allows_camera().build() From d2d159de0ad7a0877ba5e608bbbe5cd765ecb98f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Nov 2021 13:17:52 +0000 Subject: [PATCH 38/84] Bump virtualenv from 20.8.1 to 20.10.0 Bumps [virtualenv](https://github.com/pypa/virtualenv) from 20.8.1 to 20.10.0. - [Release notes](https://github.com/pypa/virtualenv/releases) - [Changelog](https://github.com/pypa/virtualenv/blob/main/docs/changelog.rst) - [Commits](https://github.com/pypa/virtualenv/compare/20.8.1...20.10.0) --- updated-dependencies: - dependency-name: virtualenv dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9acc8b0c..740fe001 100644 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ "python-coveralls==2.9.3", "coverage==4.5.4", "mock==2.0.0", - "virtualenv==20.8.1", + "virtualenv==20.10.0", "flake8==4.0.1", ], }, From 07bb943d9056cd0f5b07eb7a7e86e4dc96467891 Mon Sep 17 00:00:00 2001 From: Michal Milewicz Date: Tue, 30 Nov 2021 09:44:50 +0100 Subject: [PATCH 39/84] [SDK-2004] Add support for issuing authority sub check --- .../session/create/subcheck/__init__.py | 5 +++ .../subcheck/issuing_authority_sub_check.py | 41 +++++++++++++++++++ .../session/create/subcheck/sub_check.py | 20 +++++++++ .../session/create/subcheck/__init__.py | 0 .../test_issuing_authority_sub_check.py | 41 +++++++++++++++++++ 5 files changed, 107 insertions(+) create mode 100644 yoti_python_sdk/doc_scan/session/create/subcheck/__init__.py create mode 100644 yoti_python_sdk/doc_scan/session/create/subcheck/issuing_authority_sub_check.py create mode 100644 yoti_python_sdk/doc_scan/session/create/subcheck/sub_check.py create mode 100644 yoti_python_sdk/tests/doc_scan/session/create/subcheck/__init__.py create mode 100644 yoti_python_sdk/tests/doc_scan/session/create/subcheck/test_issuing_authority_sub_check.py diff --git a/yoti_python_sdk/doc_scan/session/create/subcheck/__init__.py b/yoti_python_sdk/doc_scan/session/create/subcheck/__init__.py new file mode 100644 index 00000000..2e248d33 --- /dev/null +++ b/yoti_python_sdk/doc_scan/session/create/subcheck/__init__.py @@ -0,0 +1,5 @@ +from .issuing_authority_sub_check import IssuingAuthoritySubCheckBuilder + +__all__ = [ + "IssuingAuthoritySubCheckBuilder", +] diff --git a/yoti_python_sdk/doc_scan/session/create/subcheck/issuing_authority_sub_check.py b/yoti_python_sdk/doc_scan/session/create/subcheck/issuing_authority_sub_check.py new file mode 100644 index 00000000..eb955e17 --- /dev/null +++ b/yoti_python_sdk/doc_scan/session/create/subcheck/issuing_authority_sub_check.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- + +from yoti_python_sdk.doc_scan.session.create.filter.document_filter import DocumentFilter +from yoti_python_sdk.utils import YotiSerializable +from .sub_check import SubRequestedCheck + + +class IssuingAuthoritySubCheck(SubRequestedCheck): + """ + Requests creation of a Issuing Authority Sub Check. + """ + + def __init__(self, filter=None): + self._filter = filter + + @property + def requested(self): + return True + + @property + def filter(self): + return self._filter + + +class IssuingAuthoritySubCheckBuilder: + """ + Builder for Issuing Authority Sub Check. + """ + def __init__(self): + self._filter = None + + def with_filter(self, filter): + if not issubclass(type(filter), DocumentFilter): + raise ValueError('invalid filter') + + self._filter = filter + + return self + + def build(self): + return IssuingAuthoritySubCheck(filter=self._filter) diff --git a/yoti_python_sdk/doc_scan/session/create/subcheck/sub_check.py b/yoti_python_sdk/doc_scan/session/create/subcheck/sub_check.py new file mode 100644 index 00000000..d4fa882d --- /dev/null +++ b/yoti_python_sdk/doc_scan/session/create/subcheck/sub_check.py @@ -0,0 +1,20 @@ +from abc import ABCMeta +from abc import abstractmethod + +from yoti_python_sdk.utils import YotiSerializable + + +class SubRequestedCheck(YotiSerializable): + """ + Requests creation of a SubCheck to be performed on a document + """ + + __metaclass__ = ABCMeta + + @property + @abstractmethod + def type(self): + raise NotImplementedError + + def to_json(self): + return remove_null_values({"type": self.type, "config": self.config}) diff --git a/yoti_python_sdk/tests/doc_scan/session/create/subcheck/__init__.py b/yoti_python_sdk/tests/doc_scan/session/create/subcheck/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/yoti_python_sdk/tests/doc_scan/session/create/subcheck/test_issuing_authority_sub_check.py b/yoti_python_sdk/tests/doc_scan/session/create/subcheck/test_issuing_authority_sub_check.py new file mode 100644 index 00000000..bd1da3f4 --- /dev/null +++ b/yoti_python_sdk/tests/doc_scan/session/create/subcheck/test_issuing_authority_sub_check.py @@ -0,0 +1,41 @@ +import unittest + +from yoti_python_sdk.doc_scan.session.create.filter.orthogonal_restrictions_filter import \ + OrthogonalRestrictionsFilterBuilder +from yoti_python_sdk.doc_scan.session.create.subcheck import ( + IssuingAuthoritySubCheckBuilder +) +from yoti_python_sdk.doc_scan.session.create.subcheck.issuing_authority_sub_check import IssuingAuthoritySubCheck + + +class IssuingAuthoritySubCheckTest(unittest.TestCase): + def test_should_build_correctly_without_additional_data(self): + issuing_authority_sub_check = IssuingAuthoritySubCheckBuilder().build() + + assert isinstance(issuing_authority_sub_check, IssuingAuthoritySubCheck) + + def test_should_build_correctly_with_filter(self): + filter = OrthogonalRestrictionsFilterBuilder().with_whitelisted_country_codes( + ["GBR", "FRA"]).with_whitelisted_document_types(["PASSPORT", "STATE_ID"]).build() + + issuing_authority_sub_check = IssuingAuthoritySubCheckBuilder().with_filter( + filter=filter).build() + + assert isinstance(issuing_authority_sub_check, IssuingAuthoritySubCheck) + assert issuing_authority_sub_check.filter == filter + + def test_should_always_build_with_requested_as_boolean_true(self): + issuing_authority_sub_check = IssuingAuthoritySubCheckBuilder().build() + + assert issuing_authority_sub_check.requested is True + + def test_build_invalid_filter(self): + filter = 'invalid' + + with self.assertRaises(ValueError): + IssuingAuthoritySubCheckBuilder().with_filter( + filter=filter).build() + + +if __name__ == "__main__": + unittest.main() From e3e31e99d6f7c1c6d63d3c642cb40405f0901d3d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Dec 2021 04:01:21 +0000 Subject: [PATCH 40/84] Bump iso8601 from 0.1.16 to 1.0.2 Bumps [iso8601](https://github.com/micktwomey/pyiso8601) from 0.1.16 to 1.0.2. - [Release notes](https://github.com/micktwomey/pyiso8601/releases) - [Commits](https://github.com/micktwomey/pyiso8601/compare/0.1.16...1.0.2) --- updated-dependencies: - dependency-name: iso8601 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- requirements.in | 2 +- requirements.txt | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.in b/requirements.in index 9fcc7209..c3586269 100644 --- a/requirements.in +++ b/requirements.in @@ -12,4 +12,4 @@ requests>=2.20.0 urllib3>=1.24.3 deprecated==1.2.13 wheel==0.33.6 -iso8601==0.1.16 +iso8601==1.0.2 diff --git a/requirements.txt b/requirements.txt index 2d8a6d06..281792c6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -24,7 +24,7 @@ future==0.18.2 # via -r requirements.in idna==2.7 # via requests -iso8601==0.1.16 +iso8601==1.0.2 # via -r requirements.in itsdangerous==2.0.1 # via -r requirements.in diff --git a/setup.py b/setup.py index 740fe001..728efb66 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ "future>=0.11.0", "asn1==2.2.0", "pyopenssl>=18.0.0", - "iso8601==0.1.16", + "iso8601==1.0.2", "pytz==2021.3", ], extras_require={ From 5d46ab8dad630c774f8ccafd02a50f13bbb4c4d8 Mon Sep 17 00:00:00 2001 From: Michal Milewicz Date: Wed, 1 Dec 2021 15:45:35 +0100 Subject: [PATCH 41/84] changes after CR --- .../session/create/subcheck/issuing_authority_sub_check.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yoti_python_sdk/doc_scan/session/create/subcheck/issuing_authority_sub_check.py b/yoti_python_sdk/doc_scan/session/create/subcheck/issuing_authority_sub_check.py index eb955e17..376171b7 100644 --- a/yoti_python_sdk/doc_scan/session/create/subcheck/issuing_authority_sub_check.py +++ b/yoti_python_sdk/doc_scan/session/create/subcheck/issuing_authority_sub_check.py @@ -7,7 +7,7 @@ class IssuingAuthoritySubCheck(SubRequestedCheck): """ - Requests creation of a Issuing Authority Sub Check. + Requests creation of an Issuing Authority Sub Check. """ def __init__(self, filter=None): From 8ca2f929dece0b34ad64341dd68f9b39ba3995bc Mon Sep 17 00:00:00 2001 From: Michal Milewicz Date: Wed, 8 Dec 2021 10:18:29 +0100 Subject: [PATCH 42/84] [SDK-1980] Add support for Session Deadline --- .../doc_scan/session/create/session_spec.py | 30 +++++++++++++++++++ .../session/retrieve/create_session_result.py | 11 +++++++ .../session/create/test_session_spec.py | 4 +++ 3 files changed, 45 insertions(+) diff --git a/yoti_python_sdk/doc_scan/session/create/session_spec.py b/yoti_python_sdk/doc_scan/session/create/session_spec.py index ef3bbce4..75a2b8be 100644 --- a/yoti_python_sdk/doc_scan/session/create/session_spec.py +++ b/yoti_python_sdk/doc_scan/session/create/session_spec.py @@ -21,6 +21,7 @@ def __init__( requested_tasks=None, required_documents=None, block_biometric_consent=None, + session_deadline=None, ): """ :param client_session_token_ttl: the client session token TTL @@ -41,6 +42,8 @@ def __init__( :type required_documents: list[RequiredDocument] or None :param block_biometric_consent: block the collection of biometric consent :type block_biometric_consent: bool + :param session_deadline: session deadline using a Zoned timestamp + "type session_deadline: str """ if requested_tasks is None: requested_tasks = [] @@ -58,6 +61,7 @@ def __init__( self.__requested_tasks = requested_tasks self.__required_documents = required_documents self.__block_biometric_consent = block_biometric_consent + self.__session_deadline = session_deadline @property def client_session_token_ttl(self): @@ -152,6 +156,16 @@ def block_biometric_consent(self): """ return self.__block_biometric_consent + @property + def session_deadline(self): + """ + Session deadline used by IDV + + :return: session deadline + :rtype: str + """ + return self.__session_deadline + def to_json(self): return remove_null_values( { @@ -164,6 +178,7 @@ def to_json(self): "sdk_config": self.sdk_config, "required_documents": self.required_documents, "block_biometric_consent": self.block_biometric_consent, + "session_deadline": self.session_deadline, } ) @@ -183,6 +198,7 @@ def __init__(self): self.__requested_tasks = [] self.__required_documents = [] self.__block_biometric_consent = None + self.__session_deadline = None def with_client_session_token_ttl(self, value): """ @@ -196,6 +212,19 @@ def with_client_session_token_ttl(self, value): self.__client_session_token_ttl = value return self + def with_session_deadline(self, value): + """ + Sets the deadline that the session needs to be completed by. + Can be used as an alternative to with_client_session_token_ttl. + + :param value: the session deadline + :type value: str + :return: the builder + :rtype: SessionSpecBuilder + """ + self.__session_deadline = value + return self + def with_resources_ttl(self, value): """ Sets the resources TTL (time-to-live) @@ -309,4 +338,5 @@ def build(self): self.__requested_tasks, self.__required_documents, self.__block_biometric_consent, + self.__session_deadline, ) diff --git a/yoti_python_sdk/doc_scan/session/retrieve/create_session_result.py b/yoti_python_sdk/doc_scan/session/retrieve/create_session_result.py index c64dd9da..2990f473 100644 --- a/yoti_python_sdk/doc_scan/session/retrieve/create_session_result.py +++ b/yoti_python_sdk/doc_scan/session/retrieve/create_session_result.py @@ -16,6 +16,7 @@ def __init__(self, data=None): data = dict() self.__client_session_token_ttl = data.get("client_session_token_ttl", None) + self.__session_deadline = data.get("session_deadline", None) self.__session_id = data.get("session_id", None) self.__client_session_token = data.get("client_session_token", None) @@ -49,3 +50,13 @@ def session_id(self): :rtype: str or None """ return self.__session_id + + @property + def session_deadline(self): + """ + The deadline that the session needs to be completed by. + + :return: the session deadline + :rtype: str or None + """ + return self.__session_deadline diff --git a/yoti_python_sdk/tests/doc_scan/session/create/test_session_spec.py b/yoti_python_sdk/tests/doc_scan/session/create/test_session_spec.py index 41f0a5e5..034c4b05 100644 --- a/yoti_python_sdk/tests/doc_scan/session/create/test_session_spec.py +++ b/yoti_python_sdk/tests/doc_scan/session/create/test_session_spec.py @@ -21,6 +21,7 @@ class SessionSpecTest(unittest.TestCase): SOME_CLIENT_SESSION_TOKEN_TTL = 300 SOME_RESOURCES_TTL = 100000 SOME_USER_TRACKING_ID = "someUserTrackingId" + SOME_SESSION_DEADLINE = "2021-09-03T11:40:54.727619+02:00" def test_should_build_correctly(self): sdk_config_mock = Mock(spec=SdkConfig) @@ -31,6 +32,7 @@ def test_should_build_correctly(self): result = ( SessionSpecBuilder() .with_client_session_token_ttl(self.SOME_CLIENT_SESSION_TOKEN_TTL) + .with_session_deadline(self.SOME_SESSION_DEADLINE) .with_resources_ttl(self.SOME_RESOURCES_TTL) .with_user_tracking_id(self.SOME_USER_TRACKING_ID) .with_notifications(notification_mock) @@ -49,6 +51,7 @@ def test_should_build_correctly(self): assert requested_check_mock in result.requested_checks assert len(result.requested_tasks) == 1 assert requested_task_mock in result.requested_tasks + assert result.session_deadline == self.SOME_SESSION_DEADLINE def test_should_serialize_to_json_without_error(self): sdk_config_mock = Mock(spec=SdkConfig) @@ -66,6 +69,7 @@ def test_should_serialize_to_json_without_error(self): result = ( SessionSpecBuilder() .with_client_session_token_ttl(self.SOME_CLIENT_SESSION_TOKEN_TTL) + .with_session_deadline(self.SOME_SESSION_DEADLINE) .with_resources_ttl(self.SOME_RESOURCES_TTL) .with_user_tracking_id(self.SOME_USER_TRACKING_ID) .with_notifications(notification_mock) From d408479240b506dac54615819d7f627beebcd268 Mon Sep 17 00:00:00 2001 From: Michal Milewicz Date: Mon, 30 Aug 2021 10:37:23 +0200 Subject: [PATCH 43/84] SDK-1901 adding WATCHLIST_SCREENING check --- .gitignore | 2 +- yoti_python_sdk/doc_scan/constants.py | 2 + .../doc_scan/session/create/check/__init__.py | 3 + .../session/create/check/watchlist_screen.py | 104 +++++++++++++++++ .../session/retrieve/check_response.py | 8 ++ .../session/retrieve/get_session_result.py | 2 + .../create/check/test_wathclist_check.py | 106 ++++++++++++++++++ yoti_python_sdk/tests/test_anchor.py | 6 +- 8 files changed, 229 insertions(+), 4 deletions(-) create mode 100644 yoti_python_sdk/doc_scan/session/create/check/watchlist_screen.py create mode 100644 yoti_python_sdk/tests/doc_scan/session/create/check/test_wathclist_check.py diff --git a/.gitignore b/.gitignore index 1cd6cf41..022b5cb0 100644 --- a/.gitignore +++ b/.gitignore @@ -105,4 +105,4 @@ examples/yoti_example_django/*.pem examples/yoti_example_flask/*.pem .scannerwork -.venv/ \ No newline at end of file +.venv/ diff --git a/yoti_python_sdk/doc_scan/constants.py b/yoti_python_sdk/doc_scan/constants.py index 6aa18d1d..279d4e5e 100644 --- a/yoti_python_sdk/doc_scan/constants.py +++ b/yoti_python_sdk/doc_scan/constants.py @@ -36,3 +36,5 @@ IGNORE = "IGNORE" PROOF_OF_ADDRESS = "PROOF_OF_ADDRESS" + +WATCHLIST_SCREENING_CHECK_TYPE = "WATCHLIST_SCREENING" diff --git a/yoti_python_sdk/doc_scan/session/create/check/__init__.py b/yoti_python_sdk/doc_scan/session/create/check/__init__.py index c0c38292..89d5689f 100644 --- a/yoti_python_sdk/doc_scan/session/create/check/__init__.py +++ b/yoti_python_sdk/doc_scan/session/create/check/__init__.py @@ -2,10 +2,13 @@ from .document_comparison import RequestedIDDocumentComparisonCheckBuilder from .face_match import RequestedFaceMatchCheckBuilder from .liveness import RequestedLivenessCheckBuilder +from .watchlist_screen import WatchlistScreeningCheckBuilder + __all__ = [ "RequestedDocumentAuthenticityCheckBuilder", "RequestedIDDocumentComparisonCheckBuilder", "RequestedFaceMatchCheckBuilder", "RequestedLivenessCheckBuilder", + "WatchlistScreeningCheckBuilder", ] diff --git a/yoti_python_sdk/doc_scan/session/create/check/watchlist_screen.py b/yoti_python_sdk/doc_scan/session/create/check/watchlist_screen.py new file mode 100644 index 00000000..8151abcf --- /dev/null +++ b/yoti_python_sdk/doc_scan/session/create/check/watchlist_screen.py @@ -0,0 +1,104 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from yoti_python_sdk.doc_scan import constants +from yoti_python_sdk.utils import YotiSerializable, remove_null_values +from .requested_check import RequestedCheck + + +class WatchlistScreeningCheckConfig(YotiSerializable): + """ + The configuration applied when creating a Watchlist screening check. + """ + + def __init__(self, manual_check, categories): + """ + :param manual_check: the watchlist screening check manual_check eg. "NEVER" + :type type: str + :param categories: list of categories for watchlist screening check config + :type max_retries: list + """ + self.__categories = categories + self.__manual_check = manual_check + + @property + def manual_check(self): + """ + Watchlist screening check manual check value + + :return: str + """ + return self.__manual_check + + @property + def categories(self): + """ + Watchlist screening check categories + + :return: list + """ + return self.__categories + + def to_json(self): + return remove_null_values( + {"manual_check": self.manual_check, "categories": self.__categories} + ) + + +class WatchlistScreeningCheck(RequestedCheck): + """ + Requests creation of a Watchlist screening check + """ + + def __init__(self, config): + """ + :param config: the Watchlist screening check configuration + :type config: WatchlistScreeningCheckConfig + """ + self.__config = config + + @property + def type(self): + return constants.WATCHLIST_SCREENING_CHECK_TYPE + + @property + def config(self): + return self.__config + + +class WatchlistScreeningCheckBuilder(object): + """ + Builder to assist creation of :class:`WatchlistScreeningCheck` + """ + + def __init__(self): + self.__categories = None + self.__manual_check = None + + def with_categories(self, categories): + """ + Sets the WatchListScreeningCheck categories + + :return: the builder + :rtype: WatchlistScreeningCheckBuilder + """ + self.__categories = categories + + return self + + def with_manual_check(self, manual_check): + """ + Sets the WatchListScreeningCheck manual_check + + :param liveness_type: the manual_check + :type liveness_type: str + :return: the builder + :rtype: WatchlistScreeningCheckBuilder + """ + self.__manual_check = manual_check + + return self + + def build(self): + config = WatchlistScreeningCheckConfig(self.__manual_check, self.__categories or []) + return WatchlistScreeningCheck(config) diff --git a/yoti_python_sdk/doc_scan/session/retrieve/check_response.py b/yoti_python_sdk/doc_scan/session/retrieve/check_response.py index f1cb515d..f05c4cf5 100644 --- a/yoti_python_sdk/doc_scan/session/retrieve/check_response.py +++ b/yoti_python_sdk/doc_scan/session/retrieve/check_response.py @@ -184,3 +184,11 @@ class SupplementaryDocumentTextDataCheckResponse(CheckResponse): """ pass + + +class WatchlistScreeningCheckResponse(CheckResponse): + """ + Represents a watchlist screening check for a given session + """ + + pass diff --git a/yoti_python_sdk/doc_scan/session/retrieve/get_session_result.py b/yoti_python_sdk/doc_scan/session/retrieve/get_session_result.py index f39eed98..7f238281 100644 --- a/yoti_python_sdk/doc_scan/session/retrieve/get_session_result.py +++ b/yoti_python_sdk/doc_scan/session/retrieve/get_session_result.py @@ -16,6 +16,7 @@ LivenessCheckResponse, TextDataCheckResponse, SupplementaryDocumentTextDataCheckResponse, + WatchlistScreeningCheckResponse, ) from .resource_container import ResourceContainer @@ -80,6 +81,7 @@ def __parse_check(check): constants.ID_DOCUMENT_FACE_MATCH: FaceMatchCheckResponse, constants.ID_DOCUMENT_TEXT_DATA_CHECK: TextDataCheckResponse, constants.LIVENESS: LivenessCheckResponse, + constants.WATCHLIST_SCREENING_CHECK_TYPE: WatchlistScreeningCheckResponse, constants.ID_DOCUMENT_COMPARISON: IDDocumentComparisonCheckResponse, constants.SUPPLEMENTARY_DOCUMENT_TEXT_DATA_CHECK: SupplementaryDocumentTextDataCheckResponse, } diff --git a/yoti_python_sdk/tests/doc_scan/session/create/check/test_wathclist_check.py b/yoti_python_sdk/tests/doc_scan/session/create/check/test_wathclist_check.py new file mode 100644 index 00000000..95d04539 --- /dev/null +++ b/yoti_python_sdk/tests/doc_scan/session/create/check/test_wathclist_check.py @@ -0,0 +1,106 @@ +import json +import unittest + +from yoti_python_sdk.doc_scan import constants +from yoti_python_sdk.doc_scan.session.create.check import ( + WatchlistScreeningCheckBuilder, +) +from yoti_python_sdk.doc_scan.session.create.check.requested_check import RequestedCheck +from yoti_python_sdk.doc_scan.session.create.check.watchlist_screen import ( + WatchlistScreeningCheck, + WatchlistScreeningCheckConfig, +) +from yoti_python_sdk.utils import YotiEncoder +from yoti_python_sdk.doc_scan.constants import WATCHLIST_SCREENING_CHECK_TYPE + + +class WatchlistScreeningCheckTest(unittest.TestCase): + def test_should_build_correctly_with_manual_check(self): + dummy_manual_check = "DUMMY_VALUE" + + result = ( + WatchlistScreeningCheckBuilder() + .with_manual_check(dummy_manual_check) + .build() + ) + + assert isinstance(result, RequestedCheck) + assert isinstance(result, WatchlistScreeningCheck) + + assert result.type == constants.WATCHLIST_SCREENING_CHECK_TYPE + assert result.config.manual_check == dummy_manual_check + assert result.config.categories == [] + + def test_should_build_corretly_with_categories(self): + dummy_categories = ["FIRST", "SECOND"] + + result = ( + WatchlistScreeningCheckBuilder() + .with_categories(dummy_categories) + .build() + ) + + assert isinstance(result, RequestedCheck) + assert isinstance(result, WatchlistScreeningCheck) + + assert result.type == constants.WATCHLIST_SCREENING_CHECK_TYPE + assert result.config.categories == dummy_categories + assert result.config.manual_check is None + + def test_should_build_correctly_with_manual_check_and_categories(self): + dummy_manual_check = "DUMMY_VALUE" + dummy_categories = ["FIRST", "SECOND"] + + result = ( + WatchlistScreeningCheckBuilder() + .with_manual_check(dummy_manual_check) + .with_categories(dummy_categories) + .build() + ) + + assert isinstance(result, RequestedCheck) + assert isinstance(result, WatchlistScreeningCheck) + + assert result.type == constants.WATCHLIST_SCREENING_CHECK_TYPE + assert result.config.manual_check == dummy_manual_check + assert result.config.categories == dummy_categories + + def test_should_serialize_to_json_without_error(self): + another_dummy_manual_check = "DUMMY_VALUE" + another_dummy_categories = ["FIRST", "SECOND"] + + result = ( + WatchlistScreeningCheckBuilder() + .with_manual_check(another_dummy_manual_check) + .with_categories(another_dummy_categories) + .build() + ) + + s = json.dumps(result, cls=YotiEncoder) + assert s is not None and s != "" + + result = ( + WatchlistScreeningCheckBuilder() + .with_categories(another_dummy_categories) + .build() + ) + + s = json.dumps(result, cls=YotiEncoder) + assert s is not None and s != "" + + s = json.loads(s) + assert s.get("type") == WATCHLIST_SCREENING_CHECK_TYPE + assert s.get("config") == {"categories": another_dummy_categories} + + result = ( + WatchlistScreeningCheckBuilder() + .with_manual_check(another_dummy_manual_check) + .build() + ) + + s = json.dumps(result, cls=YotiEncoder) + assert s is not None and s != "" + + s = json.loads(s) + assert s.get("type") == WATCHLIST_SCREENING_CHECK_TYPE + assert s.get("config") == {"manual_check": "DUMMY_VALUE", "categories": []} diff --git a/yoti_python_sdk/tests/test_anchor.py b/yoti_python_sdk/tests/test_anchor.py index 972412c9..7305d6fa 100644 --- a/yoti_python_sdk/tests/test_anchor.py +++ b/yoti_python_sdk/tests/test_anchor.py @@ -3,6 +3,7 @@ import pytz import time from datetime import datetime +from datetime import timedelta import yoti_python_sdk from yoti_python_sdk import config @@ -118,11 +119,10 @@ def test_processing_unknown_anchor_data(): (anchor.value, anchor.anchor_type, anchor.sub_type) for anchor in anchors ] - expected_timestamp = datetime(2019, 3, 5, 10, 45, 11, 840037).replace(tzinfo=None) - actual_timestamp = anchors[0].signed_timestamp.astimezone(pytz.utc).replace(tzinfo=None) + expected_timestamp = datetime(2019, 3, 5, 10, 45, 11, 840037, tzinfo=pytz.utc) + actual_timestamp = anchors[0].signed_timestamp.astimezone(pytz.utc) assert expected_timestamp == actual_timestamp - assert "document-registration-server" in [ a.value for a in anchors[0].origin_server_certs.issuer ] From e3be90a09aab736148c05c3d9ad357d55d9dbe5c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Jan 2022 04:00:53 +0000 Subject: [PATCH 44/84] Bump virtualenv from 20.10.0 to 20.12.0 Bumps [virtualenv](https://github.com/pypa/virtualenv) from 20.10.0 to 20.12.0. - [Release notes](https://github.com/pypa/virtualenv/releases) - [Changelog](https://github.com/pypa/virtualenv/blob/main/docs/changelog.rst) - [Commits](https://github.com/pypa/virtualenv/compare/20.10.0...20.12.0) --- updated-dependencies: - dependency-name: virtualenv dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 728efb66..3b73b4fe 100644 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ "python-coveralls==2.9.3", "coverage==4.5.4", "mock==2.0.0", - "virtualenv==20.10.0", + "virtualenv==20.12.0", "flake8==4.0.1", ], }, From 0a4fce7846d6d2c6b5527360487dd085d7cf6f04 Mon Sep 17 00:00:00 2001 From: Michal Milewicz Date: Thu, 23 Sep 2021 15:22:59 +0200 Subject: [PATCH 45/84] SDK-1838 auth_type for doc_scan session --- .github/workflows/sonar.yaml | 2 +- .../session/create/notification_config.py | 38 ++++++++++++++++++- .../create/test_notification_config.py | 26 +++++++++++++ yoti_python_sdk/tests/test_anchor.py | 4 +- 4 files changed, 65 insertions(+), 5 deletions(-) diff --git a/.github/workflows/sonar.yaml b/.github/workflows/sonar.yaml index d0a30566..f5055259 100644 --- a/.github/workflows/sonar.yaml +++ b/.github/workflows/sonar.yaml @@ -26,7 +26,7 @@ jobs: - run: pytest --cov=yoti_python_sdk yoti_python_sdk/tests --cov-report=xml:coverage-reports/coverage-new.xml - - run: sed -i 's+.*+/home/travis/build/getyoti/yoti-python-sdk/yoti_python_sdk+g' coverage-reports/coverage-new.xml + - run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage-reports/coverage-new.xml - uses: sonarsource/sonarcloud-github-action@master env: diff --git a/yoti_python_sdk/doc_scan/session/create/notification_config.py b/yoti_python_sdk/doc_scan/session/create/notification_config.py index 476a38b0..af68656e 100644 --- a/yoti_python_sdk/doc_scan/session/create/notification_config.py +++ b/yoti_python_sdk/doc_scan/session/create/notification_config.py @@ -16,7 +16,7 @@ class NotificationConfig(YotiSerializable): to poll for the state of the Session. """ - def __init__(self, auth_token, endpoint, topics=None): + def __init__(self, auth_token, endpoint, topics=None, auth_type=None): """ :param auth_token: the authorization token :type auth_token: str @@ -31,6 +31,7 @@ def __init__(self, auth_token, endpoint, topics=None): self.__auth_token = auth_token self.__endpoint = endpoint self.__topics = list(set(topics)) # Get unique values + self.__auth_type = auth_type @property def auth_token(self): @@ -62,9 +63,21 @@ def topics(self): """ return self.__topics + @property + def auth_type(self): + """ + The authentication type that the notification will use to + authenticate itself. + + :return: the endpoint + :rtype: str + """ + return self.__auth_type + def to_json(self): return remove_null_values( { + "auth_type": self.auth_type, "auth_token": self.auth_token, "endpoint": self.endpoint, "topics": self.topics, @@ -81,6 +94,7 @@ def __init__(self): self.__auth_token = None self.__endpoint = None self.__topics = [] + self.__auth_type = None def with_auth_token(self, token): """ @@ -154,6 +168,26 @@ def for_check_completion(self): """ return self.with_topic(CHECK_COMPLETION) + def with_basic_auth_type(self): + """ + Setup "BASIC" auth type for notifications. + + :return: the builder + :rtype: NotificationConfigBuilder + """ + self.__auth_type = "BASIC" + return self + + def with_bearer_auth_type(self): + """ + Setup "BEARER" auth type for notifications. + + :return: the builder + :rtype: NotificationConfigBuilder + """ + self.__auth_type = "BEARER" + return self + def build(self): """ Builds the :class:`NotificationConfig` using the supplied values @@ -161,4 +195,4 @@ def build(self): :return: the build notification config :rtype: NotificationConfig """ - return NotificationConfig(self.__auth_token, self.__endpoint, self.__topics) + return NotificationConfig(self.__auth_token, self.__endpoint, self.__topics, self.__auth_type) diff --git a/yoti_python_sdk/tests/doc_scan/session/create/test_notification_config.py b/yoti_python_sdk/tests/doc_scan/session/create/test_notification_config.py index f207ff14..1fa09b29 100644 --- a/yoti_python_sdk/tests/doc_scan/session/create/test_notification_config.py +++ b/yoti_python_sdk/tests/doc_scan/session/create/test_notification_config.py @@ -12,6 +12,7 @@ class NotificationConfigTest(unittest.TestCase): SOME_AUTH_TOKEN = "someAuthToken" SOME_ENDPOINT = "someEndpoint" SOME_TOPIC = "someTopic" + SOME_AUTH_TYPE = "someAuthType" def test_should_build_correctly(self): result = ( @@ -26,6 +27,7 @@ def test_should_build_correctly(self): assert result.auth_token is self.SOME_AUTH_TOKEN assert result.endpoint is self.SOME_ENDPOINT assert self.SOME_TOPIC in result.topics + assert result.auth_type is None def test_should_add_resource_update_topic(self): result = ( @@ -104,6 +106,30 @@ def test_should_store_unique_topics(self): assert len(result.topics) == 1 + def test_build_with_basic_auth_type(self): + result = ( + NotificationConfigBuilder() + .with_auth_token(self.SOME_AUTH_TOKEN) + .with_endpoint(self.SOME_ENDPOINT) + .with_topic(self.SOME_TOPIC) + .with_basic_auth_type() + .build() + ) + + assert result.auth_type is "BASIC" + + def test_build_with_bearer_auth_type(self): + result = ( + NotificationConfigBuilder() + .with_auth_token(self.SOME_AUTH_TOKEN) + .with_endpoint(self.SOME_ENDPOINT) + .with_topic(self.SOME_TOPIC) + .with_bearer_auth_type() + .build() + ) + + assert result.auth_type is "BEARER" + def test_should_serialize_to_json_without_error(self): result = ( NotificationConfigBuilder() diff --git a/yoti_python_sdk/tests/test_anchor.py b/yoti_python_sdk/tests/test_anchor.py index 972412c9..f28eb5d0 100644 --- a/yoti_python_sdk/tests/test_anchor.py +++ b/yoti_python_sdk/tests/test_anchor.py @@ -118,8 +118,8 @@ def test_processing_unknown_anchor_data(): (anchor.value, anchor.anchor_type, anchor.sub_type) for anchor in anchors ] - expected_timestamp = datetime(2019, 3, 5, 10, 45, 11, 840037).replace(tzinfo=None) - actual_timestamp = anchors[0].signed_timestamp.astimezone(pytz.utc).replace(tzinfo=None) + expected_timestamp = datetime(2019, 3, 5, 10, 45, 11, 840037, tzinfo=pytz.utc) + actual_timestamp = anchors[0].signed_timestamp.astimezone(pytz.utc) assert expected_timestamp == actual_timestamp From 247b43ddfa0f2c3f61d993aa162dde00828bd23e Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Wed, 12 Jan 2022 10:18:43 +0000 Subject: [PATCH 46/84] Don't fix version of setuptools for "check examples" --- .github/workflows/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index f2384922..be19d20a 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -44,7 +44,7 @@ jobs: with: python-version: 3.9 - - run: pip install -U setuptools==45 + - run: pip install -U setuptools - run: sudo apt install python3-distutils -y From 81988d70381a14a6883a1522f34da137f657c3a2 Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Wed, 12 Jan 2022 10:31:35 +0000 Subject: [PATCH 47/84] Revert "Don't fix version of setuptools for "check examples"" This reverts commit c422f2d254b0e80dcc75036f7e04caca789d99ff. --- .github/workflows/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index be19d20a..f2384922 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -44,7 +44,7 @@ jobs: with: python-version: 3.9 - - run: pip install -U setuptools + - run: pip install -U setuptools==45 - run: sudo apt install python3-distutils -y From 34acc2436aacec321f250fc90f7ba942f17ce12f Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Wed, 12 Jan 2022 10:50:50 +0000 Subject: [PATCH 48/84] Upgrade "six" package --- examples/doc_scan/requirements.in | 1 + examples/doc_scan/requirements.txt | 88 +++++++++++++------ examples/yoti_example_django/requirements.in | 1 + examples/yoti_example_django/requirements.txt | 85 +++++++++++++----- requirements.in | 1 + requirements.txt | 3 +- 6 files changed, 127 insertions(+), 52 deletions(-) diff --git a/examples/doc_scan/requirements.in b/examples/doc_scan/requirements.in index 6c49c931..572ae2b7 100644 --- a/examples/doc_scan/requirements.in +++ b/examples/doc_scan/requirements.in @@ -3,3 +3,4 @@ python-dotenv>=0.13.0 yoti>=2.14.0 filetype>=1.0.7 pyopenssl>=19.1.0 +six>=1.16.0 \ No newline at end of file diff --git a/examples/doc_scan/requirements.txt b/examples/doc_scan/requirements.txt index 5fb08a69..91b73492 100644 --- a/examples/doc_scan/requirements.txt +++ b/examples/doc_scan/requirements.txt @@ -1,35 +1,69 @@ # -# This file is autogenerated by pip-compile +# This file is autogenerated by pip-compile with python 3.8 # To update, run: # # pip-compile --output-file=requirements.txt requirements.in # -asn1==2.2.0 # via yoti -certifi==2020.4.5.1 # via requests -cffi==1.14.0 # via cryptography -chardet==3.0.4 # via requests -click==7.1.2 # via flask -cryptography==3.2 # via pyopenssl, yoti -deprecated==1.2.10 # via yoti -filetype==1.0.7 # via -r requirements.in -flask==1.1.2 # via -r requirements.in -future==0.18.2 # via yoti -idna==2.9 # via requests -iso8601==0.1.13 # via yoti -itsdangerous==1.1.0 # via flask -jinja2==2.11.2 # via flask -markupsafe==1.1.1 # via jinja2 -protobuf==3.11.3 # via yoti -pycparser==2.20 # via cffi -pyopenssl==19.1.0 # via -r requirements.in, yoti -python-dotenv==0.13.0 # via -r requirements.in -pytz==2020.4 # via yoti -requests==2.23.0 # via yoti -six==1.14.0 # via cryptography, protobuf, pyopenssl -urllib3==1.25.9 # via requests -werkzeug==1.0.1 # via flask -wrapt==1.12.1 # via deprecated -yoti==2.14.0 # via -r requirements.in +asn1==2.2.0 + # via yoti +certifi==2020.4.5.1 + # via requests +cffi==1.14.0 + # via cryptography +chardet==3.0.4 + # via requests +click==7.1.2 + # via flask +cryptography==3.2 + # via + # pyopenssl + # yoti +deprecated==1.2.10 + # via yoti +filetype==1.0.7 + # via -r requirements.in +flask==1.1.2 + # via -r requirements.in +future==0.18.2 + # via yoti +idna==2.9 + # via requests +iso8601==0.1.13 + # via yoti +itsdangerous==1.1.0 + # via flask +jinja2==2.11.2 + # via flask +markupsafe==1.1.1 + # via jinja2 +protobuf==3.11.3 + # via yoti +pycparser==2.20 + # via cffi +pyopenssl==19.1.0 + # via + # -r requirements.in + # yoti +python-dotenv==0.13.0 + # via -r requirements.in +pytz==2020.4 + # via yoti +requests==2.23.0 + # via yoti +six==1.16.0 + # via + # -r requirements.in + # cryptography + # protobuf + # pyopenssl +urllib3==1.25.9 + # via requests +werkzeug==1.0.1 + # via flask +wrapt==1.12.1 + # via deprecated +yoti==2.14.0 + # via -r requirements.in # The following packages are considered to be unsafe in a requirements file: # setuptools diff --git a/examples/yoti_example_django/requirements.in b/examples/yoti_example_django/requirements.in index 3890bd95..d99c7abd 100644 --- a/examples/yoti_example_django/requirements.in +++ b/examples/yoti_example_django/requirements.in @@ -4,3 +4,4 @@ python-dotenv>=0.7.1 requests>=2.20.0 urllib3>=1.24.2 yoti>=2.14.0 +six>=1.16.0 \ No newline at end of file diff --git a/examples/yoti_example_django/requirements.txt b/examples/yoti_example_django/requirements.txt index f20dbed6..cf5466dd 100644 --- a/examples/yoti_example_django/requirements.txt +++ b/examples/yoti_example_django/requirements.txt @@ -1,32 +1,69 @@ # -# This file is autogenerated by pip-compile +# This file is autogenerated by pip-compile with python 3.8 # To update, run: # # pip-compile --output-file=requirements.txt requirements.in # -asgiref==3.4.1 # via django -asn1==2.2.0 # via yoti -certifi==2018.4.16 # via requests -cffi==1.14.0 # via cryptography -chardet==3.0.4 # via requests -cryptography==3.2 # via pyopenssl, yoti -deprecated==1.2.10 # via yoti -django-sslserver==0.22 # via -r requirements.in -django==3.1.12 # via -r requirements.in, django-sslserver -future==0.16.0 # via yoti -idna==2.7 # via requests -iso8601==0.1.13 # via yoti -protobuf==3.6.0 # via yoti -pycparser==2.18 # via cffi -pyopenssl==18.0.0 # via yoti -python-dotenv==0.8.2 # via -r requirements.in -pytz==2020.4 # via django, yoti -requests==2.21.0 # via -r requirements.in, yoti -six==1.11.0 # via cryptography, protobuf, pyopenssl -sqlparse==0.3.0 # via django -urllib3==1.24.2 # via -r requirements.in, requests -wrapt==1.12.1 # via deprecated -yoti==2.14.0 # via -r requirements.in +asgiref==3.4.1 + # via django +asn1==2.2.0 + # via yoti +certifi==2018.4.16 + # via requests +cffi==1.14.0 + # via cryptography +chardet==3.0.4 + # via requests +cryptography==3.2 + # via + # pyopenssl + # yoti +deprecated==1.2.10 + # via yoti +django==3.1.12 + # via + # -r requirements.in + # django-sslserver +django-sslserver==0.22 + # via -r requirements.in +future==0.16.0 + # via yoti +idna==2.7 + # via requests +iso8601==0.1.13 + # via yoti +protobuf==3.6.0 + # via yoti +pycparser==2.18 + # via cffi +pyopenssl==18.0.0 + # via yoti +python-dotenv==0.8.2 + # via -r requirements.in +pytz==2020.4 + # via + # django + # yoti +requests==2.21.0 + # via + # -r requirements.in + # yoti +six==1.16.0 + # via + # -r requirements.in + # cryptography + # protobuf + # pyopenssl +sqlparse==0.3.0 + # via django +urllib3==1.24.2 + # via + # -r requirements.in + # requests +wrapt==1.12.1 + # via deprecated +yoti==2.14.0 + # via -r requirements.in # The following packages are considered to be unsafe in a requirements file: # setuptools diff --git a/requirements.in b/requirements.in index c3586269..de05cf73 100644 --- a/requirements.in +++ b/requirements.in @@ -13,3 +13,4 @@ urllib3>=1.24.3 deprecated==1.2.13 wheel==0.33.6 iso8601==1.0.2 +six>=1.16.0 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 281792c6..f91e8924 100644 --- a/requirements.txt +++ b/requirements.txt @@ -42,8 +42,9 @@ pyyaml==5.2 # via -r requirements.in requests==2.21.0 # via -r requirements.in -six==1.10.0 +six==1.16.0 # via + # -r requirements.in # cryptography # pyopenssl urllib3==1.24.3 From bb391e3220c68205ac08820e3c524baa55644977 Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Wed, 12 Jan 2022 11:07:45 +0000 Subject: [PATCH 49/84] Revert "Install python3.10-distutils" This reverts commit 9119a66dcb2e0e40619ca9e9a58ad384df9602b9. --- .github/workflows/tests.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index f2384922..8b6f8737 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -41,13 +41,9 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2.1.4 - with: - python-version: 3.9 - run: pip install -U setuptools==45 - - run: sudo apt install python3-distutils -y - - run: pushd examples/aml && pip install -r requirements.txt && popd - run: pushd examples/yoti_example_django && pip install -r requirements.txt && popd From 6fe19374fe23170a9e43336c6b866085acc92549 Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Wed, 12 Jan 2022 11:25:17 +0000 Subject: [PATCH 50/84] Use actions/setup-python v2.3.1 --- .github/workflows/tests.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 8b6f8737..e5c3780c 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -18,7 +18,7 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: actions/setup-python@v2.1.4 + - uses: actions/setup-python@v2.3.1 with: python-version: ${{ matrix.python-version }} @@ -40,7 +40,7 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: actions/setup-python@v2.1.4 + - uses: actions/setup-python@v2.3.1 - run: pip install -U setuptools==45 From d491b4e7a138276cd9a7c8c28eb8479a9b006955 Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Wed, 12 Jan 2022 11:28:02 +0000 Subject: [PATCH 51/84] Upgrade pip --- .github/workflows/tests.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index e5c3780c..a328f7a4 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -42,6 +42,8 @@ jobs: - uses: actions/setup-python@v2.3.1 + - run: python3 -m pip install --upgrade pip + - run: pip install -U setuptools==45 - run: pushd examples/aml && pip install -r requirements.txt && popd From 398374790699febb1575a2c26888b12db8e35d9d Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Wed, 12 Jan 2022 11:32:10 +0000 Subject: [PATCH 52/84] Revert "Upgrade pip": already up to date This reverts commit b6714a04ff03a3a604aa64bdfbda8aa45d8597ab. --- .github/workflows/tests.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index a328f7a4..e5c3780c 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -42,8 +42,6 @@ jobs: - uses: actions/setup-python@v2.3.1 - - run: python3 -m pip install --upgrade pip - - run: pip install -U setuptools==45 - run: pushd examples/aml && pip install -r requirements.txt && popd From f6617addbed30945daf04bc8b5fbf12533d4fb9d Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Wed, 12 Jan 2022 11:59:43 +0000 Subject: [PATCH 53/84] Use Python 3.10.0 until packages have been fixed by maintainers --- .github/workflows/tests.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index e5c3780c..ae246837 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -41,6 +41,8 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2.3.1 + with: + python-version: "3.10.0" - run: pip install -U setuptools==45 From 259c1f6c54fb84fa816ea36918de05012282e094 Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Wed, 12 Jan 2022 12:09:10 +0000 Subject: [PATCH 54/84] Add 'sudo apt-get install python3-distutils' --- .github/workflows/tests.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index ae246837..92ad0091 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -44,6 +44,8 @@ jobs: with: python-version: "3.10.0" + - run: sudo apt-get install python3-distutils + - run: pip install -U setuptools==45 - run: pushd examples/aml && pip install -r requirements.txt && popd From 1ca237c6ac05f66d39b1ab5fa4f9c1082ddc254e Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Wed, 12 Jan 2022 12:11:25 +0000 Subject: [PATCH 55/84] Revert "Use Python 3.10.0 until packages have been fixed by maintainers" This reverts commit 5cfc9babc0a0cfc42216d06d71099ed75bd2afe1. --- .github/workflows/tests.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 92ad0091..2a37f529 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -41,8 +41,6 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2.3.1 - with: - python-version: "3.10.0" - run: sudo apt-get install python3-distutils From adcce3eeb42674100faf17a446f954c5597b40ba Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Wed, 12 Jan 2022 12:11:59 +0000 Subject: [PATCH 56/84] Revert "Add 'sudo apt-get install python3-distutils'" This reverts commit fa18326d80cc07d36b3f68d3f605a65aea03802c. --- .github/workflows/tests.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 2a37f529..e5c3780c 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -42,8 +42,6 @@ jobs: - uses: actions/setup-python@v2.3.1 - - run: sudo apt-get install python3-distutils - - run: pip install -U setuptools==45 - run: pushd examples/aml && pip install -r requirements.txt && popd From b59ddb7827c36ebe437c6ce7804799e79ca7fdbe Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Wed, 12 Jan 2022 12:23:28 +0000 Subject: [PATCH 57/84] Use .version instead of distutils (distuils is deprecated) --- yoti_python_sdk/__init__.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/yoti_python_sdk/__init__.py b/yoti_python_sdk/__init__.py index a33747d5..e2084235 100644 --- a/yoti_python_sdk/__init__.py +++ b/yoti_python_sdk/__init__.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import os -from distutils.util import convert_path from os import environ - +from .version import __version__ from yoti_python_sdk.client import Client DEFAULTS = { @@ -17,11 +16,8 @@ directory_name = os.path.dirname(__file__) version_path = os.path.join(directory_name, "version.py") -ver_path = convert_path(version_path) -with open(ver_path) as ver_file: - exec(ver_file.read(), main_ns) +exec(open(version_path).read()) -__version__ = main_ns["__version__"] YOTI_API_URL = environ.get("YOTI_API_URL", DEFAULTS["YOTI_API_URL"]) YOTI_PROFILE_ENDPOINT = "/api/v1" From a00399f66ee641c2a94a08799b23c03c2830e4f0 Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Wed, 12 Jan 2022 12:27:25 +0000 Subject: [PATCH 58/84] Update packages: `future` causing a problem: ModuleNotFoundError: No module named 'distutils.command.bdist_wininst --- examples/yoti_example_django/requirements.in | 3 +- examples/yoti_example_django/requirements.txt | 14 +-- examples/yoti_example_flask/requirements.in | 3 +- examples/yoti_example_flask/requirements.txt | 94 ++++++++++++++----- requirements.in | 2 +- requirements.txt | 4 +- setup.py | 5 +- 7 files changed, 86 insertions(+), 39 deletions(-) diff --git a/examples/yoti_example_django/requirements.in b/examples/yoti_example_django/requirements.in index d99c7abd..a1f5881a 100644 --- a/examples/yoti_example_django/requirements.in +++ b/examples/yoti_example_django/requirements.in @@ -4,4 +4,5 @@ python-dotenv>=0.7.1 requests>=2.20.0 urllib3>=1.24.2 yoti>=2.14.0 -six>=1.16.0 \ No newline at end of file +six>=1.16.0 +cffi>=1.15.0 \ No newline at end of file diff --git a/examples/yoti_example_django/requirements.txt b/examples/yoti_example_django/requirements.txt index cf5466dd..ad75ff30 100644 --- a/examples/yoti_example_django/requirements.txt +++ b/examples/yoti_example_django/requirements.txt @@ -8,10 +8,14 @@ asgiref==3.4.1 # via django asn1==2.2.0 # via yoti +backports.zoneinfo==0.2.1 + # via django certifi==2018.4.16 # via requests -cffi==1.14.0 - # via cryptography +cffi==1.15.0 + # via + # -r requirements.in + # cryptography chardet==3.0.4 # via requests cryptography==3.2 @@ -20,7 +24,7 @@ cryptography==3.2 # yoti deprecated==1.2.10 # via yoti -django==3.1.12 +django==4.0.1 # via # -r requirements.in # django-sslserver @@ -41,9 +45,7 @@ pyopenssl==18.0.0 python-dotenv==0.8.2 # via -r requirements.in pytz==2020.4 - # via - # django - # yoti + # via yoti requests==2.21.0 # via # -r requirements.in diff --git a/examples/yoti_example_flask/requirements.in b/examples/yoti_example_flask/requirements.in index f59712fe..dafb4732 100644 --- a/examples/yoti_example_flask/requirements.in +++ b/examples/yoti_example_flask/requirements.in @@ -1,4 +1,4 @@ -cffi>=1.14.0 +cffi>=1.15.0 flask>=1.0.4 jinja2>=2.8.1 pyopenssl>=19.0.0 @@ -7,3 +7,4 @@ requests>=2.20.0 urllib3>=1.24.2 yoti>=2.14.0 werkzeug>=1.0.1 +six==1.16.0 \ No newline at end of file diff --git a/examples/yoti_example_flask/requirements.txt b/examples/yoti_example_flask/requirements.txt index 6d5f67d3..b516624f 100644 --- a/examples/yoti_example_flask/requirements.txt +++ b/examples/yoti_example_flask/requirements.txt @@ -1,34 +1,76 @@ # -# This file is autogenerated by pip-compile +# This file is autogenerated by pip-compile with python 3.10 # To update, run: # # pip-compile --output-file=requirements.txt requirements.in # -asn1==2.2.0 # via yoti -certifi==2018.4.16 # via requests -cffi==1.14.0 # via -r requirements.in, cryptography -chardet==3.0.4 # via requests -click==6.7 # via flask -cryptography==3.2 # via pyopenssl, yoti -deprecated==1.2.10 # via yoti -flask==1.1.1 # via -r requirements.in -future==0.16.0 # via yoti -idna==2.7 # via requests -iso8601==0.1.13 # via yoti -itsdangerous==0.24 # via flask -jinja2==2.10.1 # via -r requirements.in, flask -markupsafe==1.0 # via jinja2 -protobuf==3.6.0 # via yoti -pycparser==2.18 # via cffi -pyopenssl==19.0.0 # via -r requirements.in, yoti -python-dotenv==0.8.2 # via -r requirements.in -pytz==2020.4 # via yoti -requests==2.21.0 # via -r requirements.in, yoti -six==1.11.0 # via cryptography, protobuf, pyopenssl -urllib3==1.24.2 # via -r requirements.in, requests -werkzeug==1.0.1 # via -r requirements.in, flask -wrapt==1.12.1 # via deprecated -yoti==2.14.0 # via -r requirements.in +asn1==2.2.0 + # via yoti +certifi==2018.4.16 + # via requests +cffi==1.15.0 + # via + # -r requirements.in + # cryptography +chardet==3.0.4 + # via requests +click==6.7 + # via flask +cryptography==3.2 + # via + # pyopenssl + # yoti +deprecated==1.2.10 + # via yoti +flask==1.1.1 + # via -r requirements.in +future==0.16.0 + # via yoti +idna==2.7 + # via requests +iso8601==0.1.13 + # via yoti +itsdangerous==0.24 + # via flask +jinja2==2.10.1 + # via + # -r requirements.in + # flask +markupsafe==1.0 + # via jinja2 +protobuf==3.6.0 + # via yoti +pycparser==2.18 + # via cffi +pyopenssl==19.0.0 + # via + # -r requirements.in + # yoti +python-dotenv==0.8.2 + # via -r requirements.in +pytz==2020.4 + # via yoti +requests==2.21.0 + # via + # -r requirements.in + # yoti +six==1.16.0 + # via + # cryptography + # protobuf + # pyopenssl +urllib3==1.24.2 + # via + # -r requirements.in + # requests +werkzeug==1.0.1 + # via + # -r requirements.in + # flask +wrapt==1.12.1 + # via deprecated +yoti==2.14.0 + # via -r requirements.in # The following packages are considered to be unsafe in a requirements file: # setuptools diff --git a/requirements.in b/requirements.in index de05cf73..9c1947da 100644 --- a/requirements.in +++ b/requirements.in @@ -4,7 +4,7 @@ cffi==1.15.0 future==0.18.2 itsdangerous==2.0.1 pbr==1.10.0 -protobuf==3.19.1 +protobuf==3.19.3 pyopenssl==19.1.0 PyYAML==5.2 # PyYAML 5.3 does not support Python 3.4 pytz==2021.3 diff --git a/requirements.txt b/requirements.txt index f91e8924..6183c664 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.8 +# This file is autogenerated by pip-compile with python 3.10 # To update, run: # # pip-compile --output-file=requirements.txt requirements.in @@ -30,7 +30,7 @@ itsdangerous==2.0.1 # via -r requirements.in pbr==1.10.0 # via -r requirements.in -protobuf==3.19.1 +protobuf==3.19.3 # via -r requirements.in pycparser==2.18 # via cffi diff --git a/setup.py b/setup.py index 3b73b4fe..4b8cc0f0 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ "cryptography>=2.2.1", "protobuf>=3.1.0", "requests>=2.11.1", - "future>=0.11.0", + "future>=0.18.2", "asn1==2.2.0", "pyopenssl>=18.0.0", "iso8601==1.0.2", @@ -37,7 +37,7 @@ "Werkzeug==2.0.2", ], "dev": [ - "pre-commit==1.17.0", + "pre-commit==2.16.0", "pytest>=4.6.11", "pytest-cov>=2.7.1", "pylint==1.9.4", @@ -47,6 +47,7 @@ "mock==2.0.0", "virtualenv==20.12.0", "flake8==4.0.1", + "pip-tools==6.4.0", ], }, classifiers=[ From 7e1dbecc599cf25ee4475aa3b947e5feab4c8a1f Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Wed, 12 Jan 2022 12:36:31 +0000 Subject: [PATCH 59/84] Use requirements.in for aml example: need to fix the future version (was intalling 0.11.0 before) --- examples/aml/requirements.in | 2 ++ examples/aml/requirements.txt | 48 +++++++++++++++++++++++++++++++++-- 2 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 examples/aml/requirements.in diff --git a/examples/aml/requirements.in b/examples/aml/requirements.in new file mode 100644 index 00000000..7e25054c --- /dev/null +++ b/examples/aml/requirements.in @@ -0,0 +1,2 @@ +yoti>=2.14.0 +python-dotenv>=0.7.1 diff --git a/examples/aml/requirements.txt b/examples/aml/requirements.txt index 7e25054c..33889910 100644 --- a/examples/aml/requirements.txt +++ b/examples/aml/requirements.txt @@ -1,2 +1,46 @@ -yoti>=2.14.0 -python-dotenv>=0.7.1 +# +# This file is autogenerated by pip-compile with python 3.10 +# To update, run: +# +# pip-compile --output-file=requirements.txt requirements.in +# +asn1==2.2.0 + # via yoti +certifi==2021.10.8 + # via requests +cffi==1.15.0 + # via cryptography +charset-normalizer==2.0.10 + # via requests +cryptography==36.0.1 + # via + # pyopenssl + # yoti +deprecated==1.2.10 + # via yoti +future==0.18.2 + # via yoti +idna==3.3 + # via requests +iso8601==0.1.13 + # via yoti +protobuf==3.19.3 + # via yoti +pycparser==2.21 + # via cffi +pyopenssl==21.0.0 + # via yoti +python-dotenv==0.19.2 + # via -r requirements.in +pytz==2020.4 + # via yoti +requests==2.27.1 + # via yoti +six==1.16.0 + # via pyopenssl +urllib3==1.26.8 + # via requests +wrapt==1.13.3 + # via deprecated +yoti==2.14.0 + # via -r requirements.in From 829b5a5c2692cda74272e74ebcdc3a77e979239f Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Wed, 12 Jan 2022 12:41:54 +0000 Subject: [PATCH 60/84] Update wheel package --- requirements.in | 4 ++-- requirements.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.in b/requirements.in index 9c1947da..fbcff20a 100644 --- a/requirements.in +++ b/requirements.in @@ -7,10 +7,10 @@ pbr==1.10.0 protobuf==3.19.3 pyopenssl==19.1.0 PyYAML==5.2 # PyYAML 5.3 does not support Python 3.4 -pytz==2021.3 +pytz==2021.1 requests>=2.20.0 urllib3>=1.24.3 deprecated==1.2.13 -wheel==0.33.6 +wheel==0.37.1 iso8601==1.0.2 six>=1.16.0 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 6183c664..e4bfd742 100644 --- a/requirements.txt +++ b/requirements.txt @@ -51,7 +51,7 @@ urllib3==1.24.3 # via # -r requirements.in # requests -wheel==0.33.6 +wheel==0.37.1 # via -r requirements.in wrapt==1.11.2 # via deprecated From 052066da8269645729999bb3641023a09fd1abb2 Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Wed, 12 Jan 2022 12:43:45 +0000 Subject: [PATCH 61/84] Add wheel to setup.py --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 4b8cc0f0..bdabb887 100644 --- a/setup.py +++ b/setup.py @@ -26,6 +26,7 @@ "asn1==2.2.0", "pyopenssl>=18.0.0", "iso8601==1.0.2", + "wheel==0.37.1", "pytz==2021.3", ], extras_require={ From af033f0d005c0d17e043d33469baea4f6248fb87 Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Wed, 12 Jan 2022 12:49:01 +0000 Subject: [PATCH 62/84] pip install wheel --- .github/workflows/tests.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index e5c3780c..7fbca08f 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -44,6 +44,8 @@ jobs: - run: pip install -U setuptools==45 + - run: pip install wheel + - run: pushd examples/aml && pip install -r requirements.txt && popd - run: pushd examples/yoti_example_django && pip install -r requirements.txt && popd From 7bffc05297685f159bdc81019f835a9dc9590f26 Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Wed, 12 Jan 2022 12:52:05 +0000 Subject: [PATCH 63/84] Update django --- examples/yoti_example_django/requirements.in | 2 +- examples/yoti_example_django/requirements.txt | 2 +- examples/yoti_example_django/yoti_example/urls.py | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/yoti_example_django/requirements.in b/examples/yoti_example_django/requirements.in index a1f5881a..884d3bd9 100644 --- a/examples/yoti_example_django/requirements.in +++ b/examples/yoti_example_django/requirements.in @@ -1,4 +1,4 @@ -django>=3.0.7 +django>=4.0.1 django-sslserver>=0.22.0 python-dotenv>=0.7.1 requests>=2.20.0 diff --git a/examples/yoti_example_django/requirements.txt b/examples/yoti_example_django/requirements.txt index ad75ff30..d966b31c 100644 --- a/examples/yoti_example_django/requirements.txt +++ b/examples/yoti_example_django/requirements.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.8 +# This file is autogenerated by pip-compile with python 3.10 # To update, run: # # pip-compile --output-file=requirements.txt requirements.in diff --git a/examples/yoti_example_django/yoti_example/urls.py b/examples/yoti_example_django/yoti_example/urls.py index f8063333..77688930 100644 --- a/examples/yoti_example_django/yoti_example/urls.py +++ b/examples/yoti_example_django/yoti_example/urls.py @@ -13,17 +13,17 @@ 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ -from django.conf.urls import url +from django.urls import re_path from django.contrib import admin from .views import IndexView, AuthView, DynamicShareView, SourceConstraintsView urlpatterns = [ - url(r"^$", IndexView.as_view(), name="index"), - url(r"^yoti/auth/$", AuthView.as_view(), name="auth"), - url(r"^admin/", admin.site.urls), - url(r"^dynamic-share/$", DynamicShareView.as_view(), name="dynamic-share"), - url( + re_path(r"^$", IndexView.as_view(), name="index"), + re_path(r"^yoti/auth/$", AuthView.as_view(), name="auth"), + re_path(r"^admin/", admin.site.urls), + re_path(r"^dynamic-share/$", DynamicShareView.as_view(), name="dynamic-share"), + re_path( r"^source-constraint/$", SourceConstraintsView.as_view(), name="source-constraints", From c4cd552808189b3dffdba74943a0ce1685a15762 Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Wed, 12 Jan 2022 13:06:44 +0000 Subject: [PATCH 64/84] Remove django check (for now) --- .github/workflows/tests.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 7fbca08f..282dea92 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -48,8 +48,6 @@ jobs: - run: pushd examples/aml && pip install -r requirements.txt && popd - - run: pushd examples/yoti_example_django && pip install -r requirements.txt && popd - - run: pushd examples/yoti_example_flask && pip install -r requirements.txt && popd - run: pushd examples/doc_scan && pip install -r requirements.txt && popd From d685ba98d8a3cba11b1b0caea9f61cc8215a3b40 Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Wed, 12 Jan 2022 13:14:58 +0000 Subject: [PATCH 65/84] Remove doc_scan check: problem with cffi & Python 3.10 --- .github/workflows/tests.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 282dea92..edc79310 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -49,5 +49,3 @@ jobs: - run: pushd examples/aml && pip install -r requirements.txt && popd - run: pushd examples/yoti_example_flask && pip install -r requirements.txt && popd - - - run: pushd examples/doc_scan && pip install -r requirements.txt && popd From b269b24170f41801c5a27ab49b741fd587097d9e Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Wed, 12 Jan 2022 13:33:17 +0000 Subject: [PATCH 66/84] Update requirements.txt --- examples/doc_scan/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/doc_scan/requirements.txt b/examples/doc_scan/requirements.txt index 91b73492..f0dca95c 100644 --- a/examples/doc_scan/requirements.txt +++ b/examples/doc_scan/requirements.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.8 +# This file is autogenerated by pip-compile with python 3.10 # To update, run: # # pip-compile --output-file=requirements.txt requirements.in From fad2ce8f7386537dbfd53a05bbbaeafdd1c30ba4 Mon Sep 17 00:00:00 2001 From: Michal Milewicz Date: Tue, 18 Jan 2022 10:42:44 +0100 Subject: [PATCH 67/84] SDK-2027: adding non-latin support for session and supported documents --- .../filter/orthogonal_restrictions_filter.py | 39 ++++++++++++++++++- .../doc_scan/support/supported_documents.py | 5 +++ .../policy/source_constraint_builder.py | 16 +++++++- .../test_issuing_authority_sub_check.py | 15 +++++++ .../support/test_supported_documents.py | 18 +++++++++ .../policy/test_source_constraint_builder.py | 18 +++++++++ 6 files changed, 108 insertions(+), 3 deletions(-) diff --git a/yoti_python_sdk/doc_scan/session/create/filter/orthogonal_restrictions_filter.py b/yoti_python_sdk/doc_scan/session/create/filter/orthogonal_restrictions_filter.py index 6e0bcf4e..c86eca3b 100644 --- a/yoti_python_sdk/doc_scan/session/create/filter/orthogonal_restrictions_filter.py +++ b/yoti_python_sdk/doc_scan/session/create/filter/orthogonal_restrictions_filter.py @@ -68,11 +68,12 @@ def to_json(self): class OrthogonalRestrictionsFilter(DocumentFilter): - def __init__(self, country_restriction, type_restriction): + def __init__(self, country_restriction, type_restriction, allow_non_latin_documents=None): DocumentFilter.__init__(self, filter_type=ORTHOGONAL_RESTRICTIONS) self.__country_restriction = country_restriction self.__type_restriction = type_restriction + self.__allow_non_latin_documents = allow_non_latin_documents @property def country_restriction(self): @@ -94,10 +95,23 @@ def type_restriction(self): """ return self.__type_restriction + @property + def allow_non_latin_documents(self): + """ + Returns the flag for whether non-latin documents are allowed. + + :return: allow_non_latin_documents + :rtype: bool + """ + return self.__allow_non_latin_documents + def to_json(self): parent = DocumentFilter.to_json(self) parent["country_restriction"] = self.country_restriction parent["type_restriction"] = self.type_restriction + if self.__allow_non_latin_documents is not None: + parent["allow_non_latin_documents"] = self.__allow_non_latin_documents + return remove_null_values(parent) @@ -117,6 +131,7 @@ class OrthogonalRestrictionsFilterBuilder(object): def __init__(self): self.__country_restriction = None self.__type_restriction = None + self.__allow_non_latin_documents = None def with_whitelisted_country_codes(self, country_codes): """ @@ -170,6 +185,26 @@ def with_blacklisted_document_types(self, document_types): self.__type_restriction = TypeRestriction(INCLUSION_BLACKLIST, document_types) return self + def allow_non_latin_documents(self): + """ + Sets a True value for "allow non-latin documents" flag. + + :return: the builder + :rtype: OrthogonalRestrictionsFilterBuilder + """ + self.__allow_non_latin_documents = True + return self + + def disable_non_latin_documents(self): + """ + Sets a False value for "allow non-latin documents" flag. + + :return: the builder + :rtype: OrthogonalRestrictionsFilterBuilder + """ + self.__allow_non_latin_documents = False + return self + def build(self): """ Builds the orthogonal filter, using the supplied whitelisted/blacklisted values @@ -178,5 +213,5 @@ def build(self): :rtype: OrthogonalRestrictionsFilter """ return OrthogonalRestrictionsFilter( - self.__country_restriction, self.__type_restriction + self.__country_restriction, self.__type_restriction, self.__allow_non_latin_documents ) diff --git a/yoti_python_sdk/doc_scan/support/supported_documents.py b/yoti_python_sdk/doc_scan/support/supported_documents.py index 55505b78..a35a21e1 100644 --- a/yoti_python_sdk/doc_scan/support/supported_documents.py +++ b/yoti_python_sdk/doc_scan/support/supported_documents.py @@ -4,11 +4,16 @@ def __init__(self, data=None): data = dict() self.__type = data.get("type", None) + self.__is_strictly_latin = data.get("is_strictly_latin", None) @property def type(self): return self.__type + @property + def is_strictly_latin(self): + return self.__is_strictly_latin + class SupportedCountry(object): def __init__(self, data=None): diff --git a/yoti_python_sdk/dynamic_sharing_service/policy/source_constraint_builder.py b/yoti_python_sdk/dynamic_sharing_service/policy/source_constraint_builder.py index 273afbfc..39df5070 100644 --- a/yoti_python_sdk/dynamic_sharing_service/policy/source_constraint_builder.py +++ b/yoti_python_sdk/dynamic_sharing_service/policy/source_constraint_builder.py @@ -15,6 +15,7 @@ class SourceConstraintBuilder(object): def __init__(self): self.__soft_preference = False self.__anchors = [] + self.__is_strictly_latin = None def with_soft_preference(self, value=True): """ @@ -64,14 +65,27 @@ def with_driving_licence(self, subtype=""): """ return self.with_anchor_by_name(ANCHOR_VALUE_DRIVING_LICENCE, subtype) + def allow_strictly_latin(self): + self.__is_strictly_latin = True + return self + + def disable_strictly_latin(self): + self.__is_strictly_latin = False + return self + def build(self): """ :returns: A dict describing the source constraint """ - return { + constrain = { "type": "SOURCE", "preferred_sources": { "soft_preference": self.__soft_preference, "anchors": self.__anchors, }, } + + if self.__is_strictly_latin is not None: + constrain["is_strictly_latin"] = self.__is_strictly_latin + + return constrain diff --git a/yoti_python_sdk/tests/doc_scan/session/create/subcheck/test_issuing_authority_sub_check.py b/yoti_python_sdk/tests/doc_scan/session/create/subcheck/test_issuing_authority_sub_check.py index bd1da3f4..083ea1a0 100644 --- a/yoti_python_sdk/tests/doc_scan/session/create/subcheck/test_issuing_authority_sub_check.py +++ b/yoti_python_sdk/tests/doc_scan/session/create/subcheck/test_issuing_authority_sub_check.py @@ -29,6 +29,21 @@ def test_should_always_build_with_requested_as_boolean_true(self): assert issuing_authority_sub_check.requested is True + def test_allow_non_latin_documents_set_to_true(self): + filter = OrthogonalRestrictionsFilterBuilder().allow_non_latin_documents().build() + + assert filter.allow_non_latin_documents is True + + def test_allow_non_latin_documents_set_to_false(self): + filter = OrthogonalRestrictionsFilterBuilder().disable_non_latin_documents().build() + + assert filter.allow_non_latin_documents is False + + def test_default_non_latin_documents(self): + filter = OrthogonalRestrictionsFilterBuilder().build() + + assert 'allow_non_latin_documents' not in filter.to_json() + def test_build_invalid_filter(self): filter = 'invalid' diff --git a/yoti_python_sdk/tests/doc_scan/support/test_supported_documents.py b/yoti_python_sdk/tests/doc_scan/support/test_supported_documents.py index 762d509d..a2887318 100644 --- a/yoti_python_sdk/tests/doc_scan/support/test_supported_documents.py +++ b/yoti_python_sdk/tests/doc_scan/support/test_supported_documents.py @@ -18,6 +18,24 @@ def test_supported_document_should_not_throw_exception_on_missing_data(): assert result.type is None +def test_supported_document_created_with_is_strictly_latin_as_true(): + result = SupportedDocument({"is_strictly_latin": True}) + + assert result.is_strictly_latin is True + + +def test_supported_document_created_with_is_strictly_latin_as_false(): + result = SupportedDocument({"is_strictly_latin": False}) + + assert result.is_strictly_latin is False + + +def test_supported_document_created_without_is_strictly_latin(): + result = SupportedDocument({"type": "someSupportedDocument"}) + + assert result.is_strictly_latin is None + + def test_supported_country_should_parse_data(): data = { "code": "someCode", diff --git a/yoti_python_sdk/tests/dynamic_sharing_service/policy/test_source_constraint_builder.py b/yoti_python_sdk/tests/dynamic_sharing_service/policy/test_source_constraint_builder.py index 689fc003..20cb37e3 100644 --- a/yoti_python_sdk/tests/dynamic_sharing_service/policy/test_source_constraint_builder.py +++ b/yoti_python_sdk/tests/dynamic_sharing_service/policy/test_source_constraint_builder.py @@ -33,3 +33,21 @@ def test_with_soft_preference(): assert ANCHOR_VALUE_DRIVING_LICENCE in [a["name"] for a in anchors] assert ANCHOR_VALUE_PASSPORT in [a["name"] for a in anchors] assert constraint["preferred_sources"]["soft_preference"] + + +def test_with_is_strictly_latin_set_true(): + constraint = SourceConstraintBuilder().allow_strictly_latin().build() + + assert constraint["is_strictly_latin"] is True + + +def test_with_is_strictly_latin_set_false(): + constraint = SourceConstraintBuilder().disable_strictly_latin().build() + + assert constraint["is_strictly_latin"] is False + + +def test_with_is_strictly_latin_default(): + constraint = SourceConstraintBuilder().build() + + assert "is_strictly_latin" not in constraint From 4c73bce1b308721a874546a20b78acbd544d3efb Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Fri, 28 Jan 2022 14:07:34 +0000 Subject: [PATCH 68/84] Update dependabot assignees --- .github/dependabot.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index ec60e657..e7036d6d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,6 +9,5 @@ updates: reviewers: - echarrod - gautam-yoti - - michalmilewiczyoti assignees: - - michalmilewiczyoti + - echarrod From 88f14611877eecb48baaabf8fa7c7f07f251b34f Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Fri, 28 Jan 2022 16:36:13 +0000 Subject: [PATCH 69/84] Revert adding of strictly_latin to source constraints builder --- .../policy/source_constraint_builder.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/yoti_python_sdk/dynamic_sharing_service/policy/source_constraint_builder.py b/yoti_python_sdk/dynamic_sharing_service/policy/source_constraint_builder.py index 39df5070..273afbfc 100644 --- a/yoti_python_sdk/dynamic_sharing_service/policy/source_constraint_builder.py +++ b/yoti_python_sdk/dynamic_sharing_service/policy/source_constraint_builder.py @@ -15,7 +15,6 @@ class SourceConstraintBuilder(object): def __init__(self): self.__soft_preference = False self.__anchors = [] - self.__is_strictly_latin = None def with_soft_preference(self, value=True): """ @@ -65,27 +64,14 @@ def with_driving_licence(self, subtype=""): """ return self.with_anchor_by_name(ANCHOR_VALUE_DRIVING_LICENCE, subtype) - def allow_strictly_latin(self): - self.__is_strictly_latin = True - return self - - def disable_strictly_latin(self): - self.__is_strictly_latin = False - return self - def build(self): """ :returns: A dict describing the source constraint """ - constrain = { + return { "type": "SOURCE", "preferred_sources": { "soft_preference": self.__soft_preference, "anchors": self.__anchors, }, } - - if self.__is_strictly_latin is not None: - constrain["is_strictly_latin"] = self.__is_strictly_latin - - return constrain From 5ba64084f247383f918816d7e76cee8912ef401b Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Fri, 28 Jan 2022 15:11:46 +0000 Subject: [PATCH 70/84] Reinstate missing Github actions linting step --- .github/workflows/tests.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index edc79310..923cb3c1 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -48,4 +48,8 @@ jobs: - run: pushd examples/aml && pip install -r requirements.txt && popd + - run: pushd examples/yoti_example_django && pip install -r requirements.txt && popd + - run: pushd examples/yoti_example_flask && pip install -r requirements.txt && popd + + - run: pushd examples/doc_scan && pip install -r requirements.txt && popd From 4c0658b73db6da6163d476e897718c854642b0fe Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Fri, 28 Jan 2022 15:33:47 +0000 Subject: [PATCH 71/84] Update "check examples" steps --- .github/workflows/tests.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 923cb3c1..b80902d6 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -42,9 +42,7 @@ jobs: - uses: actions/setup-python@v2.3.1 - - run: pip install -U setuptools==45 - - - run: pip install wheel + - run: pip install --upgrade setuptools - run: pushd examples/aml && pip install -r requirements.txt && popd From 39e323d5faa0024a583afe6a7efdcc1f215627c2 Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Fri, 28 Jan 2022 15:40:44 +0000 Subject: [PATCH 72/84] && pip install --upgrade pip --- .github/workflows/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index b80902d6..28067081 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -46,7 +46,7 @@ jobs: - run: pushd examples/aml && pip install -r requirements.txt && popd - - run: pushd examples/yoti_example_django && pip install -r requirements.txt && popd + - run: pushd examples/yoti_example_django && pip install --upgrade pip && pip install -r requirements.txt && popd - run: pushd examples/yoti_example_flask && pip install -r requirements.txt && popd From 99d7650a1edd77cf07171e0d0c9ca85ec1a1f54b Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Fri, 28 Jan 2022 15:48:46 +0000 Subject: [PATCH 73/84] Run on Python 3.9 --- .github/workflows/tests.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 28067081..d93ba626 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -41,6 +41,8 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2.3.1 + with: + python-version: 3.9 - run: pip install --upgrade setuptools From 029899734ced1dc1412f2e6b02839853e6dfcc75 Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Fri, 28 Jan 2022 16:02:00 +0000 Subject: [PATCH 74/84] Update jinja package (from Flask) --- examples/yoti_example_flask/requirements.in | 2 +- examples/yoti_example_flask/requirements.txt | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/yoti_example_flask/requirements.in b/examples/yoti_example_flask/requirements.in index dafb4732..fc9dbca0 100644 --- a/examples/yoti_example_flask/requirements.in +++ b/examples/yoti_example_flask/requirements.in @@ -1,6 +1,6 @@ cffi>=1.15.0 flask>=1.0.4 -jinja2>=2.8.1 +jinja2>=3.0.3 pyopenssl>=19.0.0 python-dotenv>=0.7.1 requests>=2.20.0 diff --git a/examples/yoti_example_flask/requirements.txt b/examples/yoti_example_flask/requirements.txt index b516624f..3f900f93 100644 --- a/examples/yoti_example_flask/requirements.txt +++ b/examples/yoti_example_flask/requirements.txt @@ -32,11 +32,11 @@ iso8601==0.1.13 # via yoti itsdangerous==0.24 # via flask -jinja2==2.10.1 +jinja2==3.0.3 # via # -r requirements.in # flask -markupsafe==1.0 +markupsafe==2.0.1 # via jinja2 protobuf==3.6.0 # via yoti @@ -56,6 +56,7 @@ requests==2.21.0 # yoti six==1.16.0 # via + # -r requirements.in # cryptography # protobuf # pyopenssl From 66a167cb077ed776a15778b1982734029a80956e Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Fri, 28 Jan 2022 16:48:24 +0000 Subject: [PATCH 75/84] Remove tests after removing associated code --- .../policy/test_source_constraint_builder.py | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/yoti_python_sdk/tests/dynamic_sharing_service/policy/test_source_constraint_builder.py b/yoti_python_sdk/tests/dynamic_sharing_service/policy/test_source_constraint_builder.py index 20cb37e3..689fc003 100644 --- a/yoti_python_sdk/tests/dynamic_sharing_service/policy/test_source_constraint_builder.py +++ b/yoti_python_sdk/tests/dynamic_sharing_service/policy/test_source_constraint_builder.py @@ -33,21 +33,3 @@ def test_with_soft_preference(): assert ANCHOR_VALUE_DRIVING_LICENCE in [a["name"] for a in anchors] assert ANCHOR_VALUE_PASSPORT in [a["name"] for a in anchors] assert constraint["preferred_sources"]["soft_preference"] - - -def test_with_is_strictly_latin_set_true(): - constraint = SourceConstraintBuilder().allow_strictly_latin().build() - - assert constraint["is_strictly_latin"] is True - - -def test_with_is_strictly_latin_set_false(): - constraint = SourceConstraintBuilder().disable_strictly_latin().build() - - assert constraint["is_strictly_latin"] is False - - -def test_with_is_strictly_latin_default(): - constraint = SourceConstraintBuilder().build() - - assert "is_strictly_latin" not in constraint From 9b2eff271c4e6f31b92794c3e646abc2c7cba64a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Feb 2022 04:01:35 +0000 Subject: [PATCH 76/84] Bump pytz from 2021.1 to 2021.3 Bumps [pytz](https://github.com/stub42/pytz) from 2021.1 to 2021.3. - [Release notes](https://github.com/stub42/pytz/releases) - [Commits](https://github.com/stub42/pytz/compare/release_2021.1...release_2021.3) --- updated-dependencies: - dependency-name: pytz dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.in b/requirements.in index fbcff20a..c7728192 100644 --- a/requirements.in +++ b/requirements.in @@ -7,7 +7,7 @@ pbr==1.10.0 protobuf==3.19.3 pyopenssl==19.1.0 PyYAML==5.2 # PyYAML 5.3 does not support Python 3.4 -pytz==2021.1 +pytz==2021.3 requests>=2.20.0 urllib3>=1.24.3 deprecated==1.2.13 From 2daf3fc393cdc13a907b4b932b826eea105e3c54 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Feb 2022 04:01:12 +0000 Subject: [PATCH 77/84] Bump virtualenv from 20.12.0 to 20.13.0 Bumps [virtualenv](https://github.com/pypa/virtualenv) from 20.12.0 to 20.13.0. - [Release notes](https://github.com/pypa/virtualenv/releases) - [Changelog](https://github.com/pypa/virtualenv/blob/main/docs/changelog.rst) - [Commits](https://github.com/pypa/virtualenv/compare/20.12.0...20.13.0) --- updated-dependencies: - dependency-name: virtualenv dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index bdabb887..f1ffc580 100644 --- a/setup.py +++ b/setup.py @@ -46,7 +46,7 @@ "python-coveralls==2.9.3", "coverage==4.5.4", "mock==2.0.0", - "virtualenv==20.12.0", + "virtualenv==20.13.0", "flake8==4.0.1", "pip-tools==6.4.0", ], From 3094dd42fe8e09949057a6c725042773f283cdeb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 24 Feb 2022 10:13:18 +0000 Subject: [PATCH 78/84] Bump protobuf from 3.19.3 to 3.19.4 Bumps [protobuf](https://github.com/protocolbuffers/protobuf) from 3.19.3 to 3.19.4. - [Release notes](https://github.com/protocolbuffers/protobuf/releases) - [Changelog](https://github.com/protocolbuffers/protobuf/blob/master/generate_changelog.py) - [Commits](https://github.com/protocolbuffers/protobuf/compare/v3.19.3...v3.19.4) --- updated-dependencies: - dependency-name: protobuf dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.in | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.in b/requirements.in index c7728192..fc673ed6 100644 --- a/requirements.in +++ b/requirements.in @@ -4,7 +4,7 @@ cffi==1.15.0 future==0.18.2 itsdangerous==2.0.1 pbr==1.10.0 -protobuf==3.19.3 +protobuf==3.19.4 pyopenssl==19.1.0 PyYAML==5.2 # PyYAML 5.3 does not support Python 3.4 pytz==2021.3 diff --git a/requirements.txt b/requirements.txt index e4bfd742..090690a4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -30,7 +30,7 @@ itsdangerous==2.0.1 # via -r requirements.in pbr==1.10.0 # via -r requirements.in -protobuf==3.19.3 +protobuf==3.19.4 # via -r requirements.in pycparser==2.18 # via cffi From 46dde9d6838c7ff1d60347d84a1aceee749d6a3d Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Tue, 26 Apr 2022 15:08:53 +0100 Subject: [PATCH 79/84] Update pre-commit hooks, apply --- .pre-commit-config.yaml | 9 +++-- .../session/create/check/watchlist_screen.py | 4 +- .../filter/orthogonal_restrictions_filter.py | 8 +++- .../session/create/notification_config.py | 4 +- .../subcheck/issuing_authority_sub_check.py | 7 +++- .../session/retrieve/get_session_result.py | 2 +- .../create/check/test_wathclist_check.py | 4 +- .../test_issuing_authority_sub_check.py | 39 ++++++++++++------- 8 files changed, 49 insertions(+), 28 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d702e8d7..c94a38e6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,12 +1,13 @@ exclude: protobuf/ repos: - repo: https://github.com/ambv/black - rev: 847d468b828faff7daae297d8a20d899d2259824 + rev: 22.3.0 hooks: - id: black - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v1.2.3 + + - repo: https://github.com/PyCQA/flake8 + rev: 4.0.1 hooks: - id: flake8 args: - - --ignore=E501,W5 + - --ignore=E501,W5 \ No newline at end of file diff --git a/yoti_python_sdk/doc_scan/session/create/check/watchlist_screen.py b/yoti_python_sdk/doc_scan/session/create/check/watchlist_screen.py index 8151abcf..d686c816 100644 --- a/yoti_python_sdk/doc_scan/session/create/check/watchlist_screen.py +++ b/yoti_python_sdk/doc_scan/session/create/check/watchlist_screen.py @@ -100,5 +100,7 @@ def with_manual_check(self, manual_check): return self def build(self): - config = WatchlistScreeningCheckConfig(self.__manual_check, self.__categories or []) + config = WatchlistScreeningCheckConfig( + self.__manual_check, self.__categories or [] + ) return WatchlistScreeningCheck(config) diff --git a/yoti_python_sdk/doc_scan/session/create/filter/orthogonal_restrictions_filter.py b/yoti_python_sdk/doc_scan/session/create/filter/orthogonal_restrictions_filter.py index c86eca3b..63d634ae 100644 --- a/yoti_python_sdk/doc_scan/session/create/filter/orthogonal_restrictions_filter.py +++ b/yoti_python_sdk/doc_scan/session/create/filter/orthogonal_restrictions_filter.py @@ -68,7 +68,9 @@ def to_json(self): class OrthogonalRestrictionsFilter(DocumentFilter): - def __init__(self, country_restriction, type_restriction, allow_non_latin_documents=None): + def __init__( + self, country_restriction, type_restriction, allow_non_latin_documents=None + ): DocumentFilter.__init__(self, filter_type=ORTHOGONAL_RESTRICTIONS) self.__country_restriction = country_restriction @@ -213,5 +215,7 @@ def build(self): :rtype: OrthogonalRestrictionsFilter """ return OrthogonalRestrictionsFilter( - self.__country_restriction, self.__type_restriction, self.__allow_non_latin_documents + self.__country_restriction, + self.__type_restriction, + self.__allow_non_latin_documents, ) diff --git a/yoti_python_sdk/doc_scan/session/create/notification_config.py b/yoti_python_sdk/doc_scan/session/create/notification_config.py index af68656e..d89a5ce0 100644 --- a/yoti_python_sdk/doc_scan/session/create/notification_config.py +++ b/yoti_python_sdk/doc_scan/session/create/notification_config.py @@ -195,4 +195,6 @@ def build(self): :return: the build notification config :rtype: NotificationConfig """ - return NotificationConfig(self.__auth_token, self.__endpoint, self.__topics, self.__auth_type) + return NotificationConfig( + self.__auth_token, self.__endpoint, self.__topics, self.__auth_type + ) diff --git a/yoti_python_sdk/doc_scan/session/create/subcheck/issuing_authority_sub_check.py b/yoti_python_sdk/doc_scan/session/create/subcheck/issuing_authority_sub_check.py index 376171b7..f39b426f 100644 --- a/yoti_python_sdk/doc_scan/session/create/subcheck/issuing_authority_sub_check.py +++ b/yoti_python_sdk/doc_scan/session/create/subcheck/issuing_authority_sub_check.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- -from yoti_python_sdk.doc_scan.session.create.filter.document_filter import DocumentFilter +from yoti_python_sdk.doc_scan.session.create.filter.document_filter import ( + DocumentFilter, +) from yoti_python_sdk.utils import YotiSerializable from .sub_check import SubRequestedCheck @@ -26,12 +28,13 @@ class IssuingAuthoritySubCheckBuilder: """ Builder for Issuing Authority Sub Check. """ + def __init__(self): self._filter = None def with_filter(self, filter): if not issubclass(type(filter), DocumentFilter): - raise ValueError('invalid filter') + raise ValueError("invalid filter") self._filter = filter diff --git a/yoti_python_sdk/doc_scan/session/retrieve/get_session_result.py b/yoti_python_sdk/doc_scan/session/retrieve/get_session_result.py index 7f238281..1d995d04 100644 --- a/yoti_python_sdk/doc_scan/session/retrieve/get_session_result.py +++ b/yoti_python_sdk/doc_scan/session/retrieve/get_session_result.py @@ -81,7 +81,7 @@ def __parse_check(check): constants.ID_DOCUMENT_FACE_MATCH: FaceMatchCheckResponse, constants.ID_DOCUMENT_TEXT_DATA_CHECK: TextDataCheckResponse, constants.LIVENESS: LivenessCheckResponse, - constants.WATCHLIST_SCREENING_CHECK_TYPE: WatchlistScreeningCheckResponse, + constants.WATCHLIST_SCREENING_CHECK_TYPE: WatchlistScreeningCheckResponse, constants.ID_DOCUMENT_COMPARISON: IDDocumentComparisonCheckResponse, constants.SUPPLEMENTARY_DOCUMENT_TEXT_DATA_CHECK: SupplementaryDocumentTextDataCheckResponse, } diff --git a/yoti_python_sdk/tests/doc_scan/session/create/check/test_wathclist_check.py b/yoti_python_sdk/tests/doc_scan/session/create/check/test_wathclist_check.py index 95d04539..3bfec82b 100644 --- a/yoti_python_sdk/tests/doc_scan/session/create/check/test_wathclist_check.py +++ b/yoti_python_sdk/tests/doc_scan/session/create/check/test_wathclist_check.py @@ -35,9 +35,7 @@ def test_should_build_corretly_with_categories(self): dummy_categories = ["FIRST", "SECOND"] result = ( - WatchlistScreeningCheckBuilder() - .with_categories(dummy_categories) - .build() + WatchlistScreeningCheckBuilder().with_categories(dummy_categories).build() ) assert isinstance(result, RequestedCheck) diff --git a/yoti_python_sdk/tests/doc_scan/session/create/subcheck/test_issuing_authority_sub_check.py b/yoti_python_sdk/tests/doc_scan/session/create/subcheck/test_issuing_authority_sub_check.py index 083ea1a0..677dfc40 100644 --- a/yoti_python_sdk/tests/doc_scan/session/create/subcheck/test_issuing_authority_sub_check.py +++ b/yoti_python_sdk/tests/doc_scan/session/create/subcheck/test_issuing_authority_sub_check.py @@ -1,11 +1,14 @@ import unittest -from yoti_python_sdk.doc_scan.session.create.filter.orthogonal_restrictions_filter import \ - OrthogonalRestrictionsFilterBuilder +from yoti_python_sdk.doc_scan.session.create.filter.orthogonal_restrictions_filter import ( + OrthogonalRestrictionsFilterBuilder, +) from yoti_python_sdk.doc_scan.session.create.subcheck import ( - IssuingAuthoritySubCheckBuilder + IssuingAuthoritySubCheckBuilder, +) +from yoti_python_sdk.doc_scan.session.create.subcheck.issuing_authority_sub_check import ( + IssuingAuthoritySubCheck, ) -from yoti_python_sdk.doc_scan.session.create.subcheck.issuing_authority_sub_check import IssuingAuthoritySubCheck class IssuingAuthoritySubCheckTest(unittest.TestCase): @@ -15,11 +18,16 @@ def test_should_build_correctly_without_additional_data(self): assert isinstance(issuing_authority_sub_check, IssuingAuthoritySubCheck) def test_should_build_correctly_with_filter(self): - filter = OrthogonalRestrictionsFilterBuilder().with_whitelisted_country_codes( - ["GBR", "FRA"]).with_whitelisted_document_types(["PASSPORT", "STATE_ID"]).build() + filter = ( + OrthogonalRestrictionsFilterBuilder() + .with_whitelisted_country_codes(["GBR", "FRA"]) + .with_whitelisted_document_types(["PASSPORT", "STATE_ID"]) + .build() + ) - issuing_authority_sub_check = IssuingAuthoritySubCheckBuilder().with_filter( - filter=filter).build() + issuing_authority_sub_check = ( + IssuingAuthoritySubCheckBuilder().with_filter(filter=filter).build() + ) assert isinstance(issuing_authority_sub_check, IssuingAuthoritySubCheck) assert issuing_authority_sub_check.filter == filter @@ -30,26 +38,29 @@ def test_should_always_build_with_requested_as_boolean_true(self): assert issuing_authority_sub_check.requested is True def test_allow_non_latin_documents_set_to_true(self): - filter = OrthogonalRestrictionsFilterBuilder().allow_non_latin_documents().build() + filter = ( + OrthogonalRestrictionsFilterBuilder().allow_non_latin_documents().build() + ) assert filter.allow_non_latin_documents is True def test_allow_non_latin_documents_set_to_false(self): - filter = OrthogonalRestrictionsFilterBuilder().disable_non_latin_documents().build() + filter = ( + OrthogonalRestrictionsFilterBuilder().disable_non_latin_documents().build() + ) assert filter.allow_non_latin_documents is False def test_default_non_latin_documents(self): filter = OrthogonalRestrictionsFilterBuilder().build() - assert 'allow_non_latin_documents' not in filter.to_json() + assert "allow_non_latin_documents" not in filter.to_json() def test_build_invalid_filter(self): - filter = 'invalid' + filter = "invalid" with self.assertRaises(ValueError): - IssuingAuthoritySubCheckBuilder().with_filter( - filter=filter).build() + IssuingAuthoritySubCheckBuilder().with_filter(filter=filter).build() if __name__ == "__main__": From 137fc6cefcd380267cd81f5822e89d4ba8bb3285 Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Tue, 26 Apr 2022 15:09:11 +0100 Subject: [PATCH 80/84] Update dev dependencies --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index bdabb887..8006933c 100644 --- a/setup.py +++ b/setup.py @@ -39,7 +39,7 @@ ], "dev": [ "pre-commit==2.16.0", - "pytest>=4.6.11", + "pytest>=7.1.2", "pytest-cov>=2.7.1", "pylint==1.9.4", "pylint-exit>=1.1.0", @@ -48,7 +48,7 @@ "mock==2.0.0", "virtualenv==20.12.0", "flake8==4.0.1", - "pip-tools==6.4.0", + "pip-tools==6.6.0", ], }, classifiers=[ From 4c2fc0409e0f48b77c354036e8820bf166813a0d Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Tue, 26 Apr 2022 15:09:25 +0100 Subject: [PATCH 81/84] Update pytz dependency --- requirements.in | 2 +- requirements.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.in b/requirements.in index fbcff20a..079fb0a4 100644 --- a/requirements.in +++ b/requirements.in @@ -7,7 +7,7 @@ pbr==1.10.0 protobuf==3.19.3 pyopenssl==19.1.0 PyYAML==5.2 # PyYAML 5.3 does not support Python 3.4 -pytz==2021.1 +pytz==2022.1 requests>=2.20.0 urllib3>=1.24.3 deprecated==1.2.13 diff --git a/requirements.txt b/requirements.txt index e4bfd742..871e71d9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.10 +# This file is autogenerated by pip-compile with python 3.9 # To update, run: # # pip-compile --output-file=requirements.txt requirements.in @@ -36,7 +36,7 @@ pycparser==2.18 # via cffi pyopenssl==19.1.0 # via -r requirements.in -pytz==2021.3 +pytz==2022.1 # via -r requirements.in pyyaml==5.2 # via -r requirements.in From cf1adb7cb22684a605833b7a93c26d1e51bc407b Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Tue, 26 Apr 2022 15:09:46 +0100 Subject: [PATCH 82/84] Update Flask dependencies, and run command --- examples/yoti_example_flask/README.md | 2 +- examples/yoti_example_flask/requirements.in | 1 + examples/yoti_example_flask/requirements.txt | 8 +++++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/examples/yoti_example_flask/README.md b/examples/yoti_example_flask/README.md index 2589ede5..b63600f1 100644 --- a/examples/yoti_example_flask/README.md +++ b/examples/yoti_example_flask/README.md @@ -2,5 +2,5 @@ 1. Rename the [.env.example](.env.example) file to `.env` and fill in the required configuration values 1. Install dependencies: `pip install -r requirements.txt` -1. Run `python app.py` +1. Run `python -m flask run` 1. Navigate to https://localhost:5000 \ No newline at end of file diff --git a/examples/yoti_example_flask/requirements.in b/examples/yoti_example_flask/requirements.in index fc9dbca0..89d0b0ee 100644 --- a/examples/yoti_example_flask/requirements.in +++ b/examples/yoti_example_flask/requirements.in @@ -1,3 +1,4 @@ +click>=7 cffi>=1.15.0 flask>=1.0.4 jinja2>=3.0.3 diff --git a/examples/yoti_example_flask/requirements.txt b/examples/yoti_example_flask/requirements.txt index 3f900f93..81f2e9f6 100644 --- a/examples/yoti_example_flask/requirements.txt +++ b/examples/yoti_example_flask/requirements.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.10 +# This file is autogenerated by pip-compile with python 3.9 # To update, run: # # pip-compile --output-file=requirements.txt requirements.in @@ -14,8 +14,10 @@ cffi==1.15.0 # cryptography chardet==3.0.4 # via requests -click==6.7 - # via flask +click==8.1.2 + # via + # -r requirements.in + # flask cryptography==3.2 # via # pyopenssl From 0b1e723713848cdc9b1af7469630bcc3c6d50cb5 Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Tue, 26 Apr 2022 15:16:13 +0100 Subject: [PATCH 83/84] Remove Python 3.6 from tests, EOL on 23 Dec 2021 https://endoflife.date/python --- .github/workflows/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index d93ba626..9506b63c 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.6, 3.7, 3.8, 3.9, "3.10"] + python-version: [3.7, 3.8, 3.9, "3.10"] steps: - uses: actions/checkout@v2 From efd48c28fea257320cfdc59a45483ab23b51d2e0 Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Wed, 27 Apr 2022 16:08:39 +0100 Subject: [PATCH 84/84] Update Dockerfile Python versions --- examples/yoti_example_django/Dockerfile | 2 +- examples/yoti_example_flask/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/yoti_example_django/Dockerfile b/examples/yoti_example_django/Dockerfile index 50c2bf9b..0eed957f 100644 --- a/examples/yoti_example_django/Dockerfile +++ b/examples/yoti_example_django/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.7-slim +FROM python:3.9-slim ARG YOTI_SCENARIO_ID ARG YOTI_CLIENT_SDK_ID ARG YOTI_KEY_FILE_PATH diff --git a/examples/yoti_example_flask/Dockerfile b/examples/yoti_example_flask/Dockerfile index a590e43a..4ec911ef 100644 --- a/examples/yoti_example_flask/Dockerfile +++ b/examples/yoti_example_flask/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.6.3 +FROM python:3.9.12 ARG YOTI_SCENARIO_ID ARG YOTI_CLIENT_SDK_ID ARG YOTI_KEY_FILE_PATH