Skip to content

Commit

Permalink
Merge pull request #270 from getyoti/release/2.14.0
Browse files Browse the repository at this point in the history
Release 2.14.0
  • Loading branch information
davidgrayston authored Nov 16, 2020
2 parents fa6337e + 1ceff9f commit eff67c4
Show file tree
Hide file tree
Showing 43 changed files with 1,175 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
interval: monthly
open-pull-requests-limit: 3
target-branch: development
reviewers:
Expand Down
30 changes: 23 additions & 7 deletions examples/doc_scan/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
RequestedIDDocumentComparisonCheckBuilder,
RequestedLivenessCheckBuilder,
RequestedTextExtractionTaskBuilder,
RequestedSupplementaryDocTextExtractionTaskBuilder,
SdkConfigBuilder,
SessionSpecBuilder,
)
Expand All @@ -15,6 +16,10 @@
RequiredIdDocumentBuilder,
DocumentRestrictionBuilder,
DocumentRestrictionsFilterBuilder,
RequiredSupplementaryDocumentBuilder,
)
from yoti_python_sdk.doc_scan.session.create.objective import (
ProofOfAddressObjectiveBuilder,
)

from .settings import YOTI_APP_BASE_URL, YOTI_CLIENT_SDK_ID, YOTI_KEY_FILE_PATH
Expand Down Expand Up @@ -52,7 +57,7 @@ def create_session():
.with_user_tracking_id("some-user-tracking-id")
.with_requested_check(
RequestedDocumentAuthenticityCheckBuilder()
.with_manual_check_never()
.with_manual_check_always()
.build()
)
.with_requested_check(
Expand All @@ -62,19 +67,27 @@ def create_session():
.build()
)
.with_requested_check(
RequestedFaceMatchCheckBuilder().with_manual_check_never().build()
RequestedFaceMatchCheckBuilder().with_manual_check_always().build()
)
.with_requested_check(RequestedIDDocumentComparisonCheckBuilder().build())
.with_requested_task(
RequestedTextExtractionTaskBuilder()
.with_manual_check_never()
.with_manual_check_always()
.with_chip_data_desired()
.build()
)
.with_requested_task(
RequestedSupplementaryDocTextExtractionTaskBuilder()
.with_manual_check_always()
.build()
)
.with_sdk_config(sdk_config)
.with_required_document(build_required_id_document_restriction("PASSPORT"))
.with_required_document(RequiredIdDocumentBuilder().build())
.with_required_document(
build_required_id_document_restriction("DRIVING_LICENCE")
RequiredSupplementaryDocumentBuilder()
.with_objective(ProofOfAddressObjectiveBuilder().build())
.build()
)
.build()
)
Expand All @@ -98,7 +111,7 @@ def index():
try:
result = create_session()
except DocScanException as e:
return render_template("error.html", error=e.text)
return render_template("error.html", error=e.message)

session["doc_scan_session_id"] = result.session_id

Expand All @@ -120,7 +133,7 @@ def success():
try:
session_result = doc_scan_client.get_session(session_id)
except DocScanException as e:
return render_template("error.html", error=e.text)
return render_template("error.html", error=e.message)

return render_template("success.html", session_result=session_result)

Expand Down Expand Up @@ -150,7 +163,10 @@ def media():
try:
retrieved_media = doc_scan_client.get_media_content(session_id, media_id)
except DocScanException as e:
return render_template("error.html", error=e.text)
return render_template("error.html", error=e.message)

if retrieved_media is None:
return Response("", status=204)

return Response(
retrieved_media.content, content_type=retrieved_media.mime_type, status=200
Expand Down
2 changes: 1 addition & 1 deletion examples/doc_scan/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ 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==2.9.2 # via pyopenssl, yoti
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
Expand Down
216 changes: 213 additions & 3 deletions examples/doc_scan/templates/success.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,20 @@ <h3 class="mb-0">
</div>
</div>
{% endif %}
{% if session_result.text_data_checks|length > 0 %}
{% if session_result.id_document_text_data_checks|length > 0 %}
<div class="card">
<div class="card-header" id="text-data-checks">
<h3 class="mb-0">
<button class="btn btn-link" type="button" data-toggle="collapse"
data-target="#collapse-text-data-checks" aria-expanded="true"
aria-controls="collapse-text-data-checks">
Text Data Checks
ID Document Text Data Checks
</button>
</h3>
</div>
<div id="collapse-text-data-checks" class="collapse" aria-labelledby="text-data-checks">
<div class="card-body">
{% for check in session_result.text_data_checks %}
{% for check in session_result.id_document_text_data_checks %}
{% with check=check %}
{% include "partials/check.html" %}
{% endwith %}
Expand Down Expand Up @@ -163,6 +163,29 @@ <h3 class="mb-0">
</div>
</div>
{% endif %}

{% if session_result.supplementary_document_text_data_checks|length > 0 %}
<div class="card">
<div class="card-header" id="sup-doc-text-data-checks">
<h3 class="mb-0">
<button class="btn btn-link" type="button" data-toggle="collapse"
data-target="#collapse-sup-doc-text-data-checks" aria-expanded="true"
aria-controls="collapse-sup-doc-text-data-checks">
Supplementary Document Text Data Checks
</button>
</h3>
</div>
<div id="collapse-sup-doc-text-data-checks" class="collapse" aria-labelledby="sup-doc-text-data-checks">
<div class="card-body">
{% for check in session_result.supplementary_document_text_data_checks %}
{% with check=check %}
{% include "partials/check.html" %}
{% endwith %}
{% endfor %}
</div>
</div>
</div>
{% endif %}
</div>
</div>
</div>
Expand Down Expand Up @@ -360,6 +383,193 @@ <h5 class="card-title">Frame</h5>
{% endfor %}
{% endwith %}

{% if session_result.resources.supplementary_documents|length > 0 %}
<div class="row pt-4">
<div class="col">
<h2>Supplementary Documents</h2>
</div>
</div>
{% endif %}

{% with doc_num=0 %}
{% for document in session_result.resources.supplementary_documents %}
{% set doc_num = loop.index %}
<div class="row pt-4">
<div class="col">

<h3>
{{ document.document_type }} <span
class="badge badge-primary">{{ document.issuing_country }}</span>
</h3>

<div class="accordion mt-3">
{% if document.document_fields is not none %}
<div class="card">
<div class="card-header" id="sup-doc-fields-{{ doc_num }}">
<h4 class="mb-0">
<button class="btn btn-link" type="button" data-toggle="collapse"
data-target="#collapse-sup-doc-fields-{{ doc_num }}"
aria-expanded="true"
aria-controls="collapse-sup-doc-fields-{{ doc_num }}">
Document Fields
</button>
</h4>
</div>
<div id="collapse-sup-doc-fields-{{ doc_num }}" class="collapse"
aria-labelledby="sup-doc-fields-{{ doc_num }}">
<div class="card-body">
{% if document.document_fields.media is not none %}
<h5>Media</h5>
<table class="table table-striped table-light">
<tbody>
<tr>
<td>ID</td>
<td>
<a href="/media?mediaId={{ document.document_fields.media.id }}">
{{ document.document_fields.media.id }}
</a>
</td>
</tr>
</tbody>
</table>
{% endif %}
</div>
</div>
</div>
{% endif %}

{% if document.document_file is not none %}
{% if document.document_file.media is not none %}
<div class="card">
<div class="card-header" id="sup-doc-file-{{ doc_num }}">
<h4 class="mb-0">
<a class="btn btn-link" href="/media?mediaId={{ document.document_file.media.id }}">
Download File
</a>
</h4>
</div>
</div>
{% endif %}
{% endif %}

{% if document.text_extraction_tasks|length > 0 %}
<div class="card">
<div class="card-header" id="text-extraction-tasks-{{ doc_num }}">
<h4 class="mb-0">
<button class="btn btn-link" type="button" data-toggle="collapse"
data-target="#collapse-text-extraction-tasks-{{ doc_num }}"
aria-expanded="true"
aria-controls="collapse-text-extraction-tasks-{{ doc_num }}">
Text Extraction Tasks
</button>
</h4>
</div>
<div id="collapse-text-extraction-tasks-{{ doc_num }}" class="collapse"
aria-labelledby="text-extraction-tasks-{{ doc_num }}">
<div class="card-body">
{% for task in document.text_extraction_tasks %}

{% with task=task %}
{% include "partials/task.html" %}
{% endwith %}

{% if task.generated_text_data_checks|length > 0 %}
<h5>Generated Text Data Checks</h5>

{% for generated_check in task.generated_text_data_checks %}
<table class="table table-striped">
<tbody>
<tr>
<td>ID</td>
<td>{{ generated_check.id }}</td>
</tr>
</tbody>
</table>
{% endfor %}
{% endif %}

{% if task.generated_media|length > 0 %}
<h5>Generated Media</h5>

{% for generated_media in task.generated_media %}
<table class="table table-striped">
<tbody>
<tr>
<td>ID</td>
<td>
<a href="/media?mediaId={{ generated_media.id }}">{{ generated_media.id }}</a>
</td>
</tr>
<tr>
<td>Type</td>
<td>{{ generated_media.type }}</td>
</tr>
</tbody>
</table>
{% endfor %}
{% endif %}
{% endfor %}
</div>
</div>
</div>
{% endif %}

{% if document.pages|length > 0 %}
{% with page_num=0 %}
{% for page in document.pages %}
{% set page_num = loop.index %}
<div class="card">
<div class="card-header" id="sup-doc-pages-{{ doc_num }}-{{ page_num }}">
<h4 class="mb-0">
<button class="btn btn-link" type="button" data-toggle="collapse"
data-target="#collapse-sup-doc-pages-{{ doc_num }}-{{ page_num }}"
aria-expanded="true"
aria-controls="collapse-sup-doc-pages-{{ doc_num }}-{{ page_num }}">
Page {{ page_num }}
</button>
</h4>
</div>
<div id="collapse-sup-doc-pages-{{ doc_num }}-{{ page_num }}" class="collapse"
aria-labelledby="sup-doc-pages-{{ doc_num }}-{{ page_num }}">

<div class="card-group">
{% if page.media is not none %}
<div class="card" style="width: 18rem;">
<img class="card-img-top"
src="/media?mediaId={{ page.media.id }}"/>
<div class="card-body">
<p>Method: {{ page.capture_method }}</p>
</div>
</div>
{% endif %}
</div>

{% if page.frames|length > 0 %}
<div class="card-group">
{% for frame in page.frames %}
{% if frame.media is not none %}
<div class="card">
<img class="card-img-top" src="/media?mediaId={{ frame.media.id }}" />
<div class="card-body">
<h5 class="card-title">Frame</h5>
</div>
</div>
{% endif %}
{% endfor %}
</div>
{% endif %}

</div>
</div>
{% endfor %}
{% endwith %}
{% endif %}
</div>
</div>
</div>
{% endfor %}
{% endwith %}

{% if session_result.resources.zoom_liveness_resources|length > 0 %}
<div class="row pt-4">
<div class="col">
Expand Down
2 changes: 1 addition & 1 deletion examples/yoti_example_django/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ 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==2.9.2 # via pyopenssl, yoti
cryptography==3.2 # via pyopenssl, yoti
deprecated==1.2.10 # via yoti
django-sslserver==0.22 # via -r requirements.in
django==3.0.7 # via -r requirements.in, django-sslserver
Expand Down
2 changes: 1 addition & 1 deletion examples/yoti_example_flask/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ 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==2.9.2 # via pyopenssl, yoti
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
Expand Down
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pbr==1.10.0
protobuf==3.13.0
pyopenssl==19.1.0
PyYAML==5.2 # PyYAML 5.3 does not support Python 3.4
pytz==2020.1
pytz==2020.4
requests>=2.20.0
urllib3>=1.24.3
deprecated==1.2.10
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pbr==1.10.0 # via -r requirements.in
protobuf==3.13.0 # via -r requirements.in
pycparser==2.18 # via cffi
pyopenssl==19.1.0 # via -r requirements.in
pytz==2020.1 # 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
Expand Down
Loading

0 comments on commit eff67c4

Please sign in to comment.