Skip to content

Commit cb2fe93

Browse files
author
Omari Rodney
committed
Do not try to fetch profiles if there is no content available
1 parent 5f48d38 commit cb2fe93

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,4 @@ ENV/
9292
# IDE
9393
.idea/
9494
*.un~
95+
.history/

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## [1.1.0] - 2017-03-20
9+
### Changed
10+
- Allow empty profiles
11+
812
## [0.1.2] - 2016-11-23
913

1014
### Fixed

yoti_python_sdk/activity_details.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44

55
class ActivityDetails:
6-
def __init__(self, receipt, decrypted_profile):
6+
def __init__(self, receipt, decrypted_profile = None):
77
self.decrypted_profile = decrypted_profile
88
self.user_profile = {}
99

10-
if hasattr(decrypted_profile, 'attributes'):
10+
if decrypted_profile and hasattr(decrypted_profile, 'attributes'):
1111
for field in decrypted_profile.attributes:
1212
value = Protobuf().value_based_on_content_type(
1313
field.value,

yoti_python_sdk/client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ def get_activity_details(self, encrypted_request_token):
5757

5858
encrypted_data = protobuf.Protobuf().current_user(receipt)
5959

60+
if not encrypted_data:
61+
return ActivityDetails(receipt)
62+
6063
unwrapped_key = self.__crypto.decrypt_token(receipt['wrapped_receipt_key'])
6164
decrypted_data = self.__crypto.decipher(
6265
unwrapped_key,

yoti_python_sdk/protobuf/v1/protobuf.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ class Protobuf(object):
1515
CT_PNG = 4 # standard .png image
1616

1717
def current_user(self, receipt):
18-
if receipt.get('other_party_profile_content') is None:
19-
raise ValueError('The receipt has invalid data')
18+
if receipt.get('other_party_profile_content') is None or receipt.get('other_party_profile_content') == '':
19+
return None
20+
2021
profile_content = receipt['other_party_profile_content']
2122
decoded_profile_content = base64.b64decode(profile_content)
2223

0 commit comments

Comments
 (0)