-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #200 from getyoti/2.12.1-Release
2.12.1 release
- Loading branch information
Showing
6 changed files
with
117 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
asn1==2.2.0 | ||
cryptography>=2.8.0 | ||
cffi>=1.13.0 | ||
cffi>=1.14.0 | ||
future==0.18.2 | ||
itsdangerous==0.24 | ||
pbr==1.10.0 | ||
protobuf==3.11.3 | ||
pyopenssl==18.0.0 | ||
PyYAML==5.2 # PyYAML 5.3 does not support Python 3.4 | ||
pytz==2018.9 | ||
pytz==2020.1 | ||
requests>=2.20.0 | ||
urllib3>=1.24.2 | ||
urllib3>=1.24.3 | ||
deprecated==1.2.6 | ||
wheel==0.24.0 | ||
iso8601==0.1.12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 27 additions & 4 deletions
31
yoti_python_sdk/dynamic_sharing_service/extension/third_party_attribute_extension.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,46 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
import copy | ||
|
||
import pytz | ||
|
||
|
||
class ThirdPartyAttributeExtension(object): | ||
THIRDPARTY_ATTRIBUTE = "THIRD_PARTY_ATTRIBUTE" | ||
|
||
def __init__(self): | ||
self.__extension = {} | ||
self.__extension["type"] = self.THIRDPARTY_ATTRIBUTE | ||
self.__extension["content"] = {"expiry_date": None, "definitions": []} | ||
self.__extension = { | ||
"type": self.THIRDPARTY_ATTRIBUTE, | ||
"content": {"expiry_date": None, "definitions": []}, | ||
} | ||
|
||
def with_expiry_date(self, expiry_date): | ||
self.__extension["content"]["expiry_date"] = expiry_date.isoformat() | ||
""" | ||
:param expiry_date: Expiry date for the attribute. If no timezone info is provided, UTC will be used. | ||
:type expiry_date: datetime | ||
""" | ||
if expiry_date.tzinfo is None: | ||
expiry_date = expiry_date.replace(tzinfo=pytz.UTC) | ||
|
||
utc_time = expiry_date.astimezone(pytz.utc) | ||
rfc_3339_milliseconds = utc_time.strftime("%Y-%m-%dT%H:%M:%S.%f")[:-3] | ||
self.__extension["content"]["expiry_date"] = rfc_3339_milliseconds + "Z" | ||
return self | ||
|
||
def with_definitions(self, *names): | ||
""" | ||
:param names: attribute definitions | ||
:type names: str or list[str] | ||
""" | ||
self.__extension["content"]["definitions"].extend([{"name": s} for s in names]) | ||
return self | ||
|
||
def build(self): | ||
""" | ||
Builds the object | ||
:return: the third party attribute | ||
:rtype: ThirdPartyAttributeExtension | ||
""" | ||
return copy.deepcopy(self.__extension) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# -*- coding: utf-8 -*- | ||
__version__ = "2.12.0" | ||
__version__ = "2.12.1" |