Skip to content

Commit 0145bed

Browse files
committed
Allows the Client to be imported directly from yoti package
1 parent 61d73dc commit 0145bed

File tree

7 files changed

+20
-13
lines changed

7 files changed

+20
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ securely verify users' identities.
55

66
## Example ##
77

8-
from yoti.client import Client
8+
from yoti import Client
99

1010
@app.route('/callback')
1111
def callback():

examples/yoti_example_django/yoti_example/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from django.views.generic import TemplateView
22

3-
from yoti.client import Client
3+
from yoti import Client
44

55
from .app_settings import (
66
YOTI_APPLICATION_ID,

examples/yoti_example_flask/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from flask import Flask, render_template, request
22

3-
from yoti.client import Client
3+
from yoti import Client
44

55
from settings import (
66
YOTI_APPLICATION_ID,

yoti/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# -*- coding: utf-8 -*-
22
from os import environ
33

4+
from yoti.client import Client
5+
46
DEFAULTS = {
57
'YOTI_API_URL': 'https://api.yoti.com',
68
'YOTI_API_PORT': 443,
@@ -11,3 +13,8 @@
1113
YOTI_API_PORT = environ.get('YOTI_API_PORT', DEFAULTS['YOTI_API_PORT'])
1214
YOTI_API_VERSION = environ.get('YOTI_API_VERSION', DEFAULTS['YOTI_API_VERSION'])
1315
YOTI_API_ENDPOINT = '{0}:{1}/api/{2}'.format(YOTI_API_URL, YOTI_API_PORT, YOTI_API_VERSION)
16+
17+
18+
__all__ = [
19+
'Client',
20+
]

yoti/client.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
# -*- coding: utf-8 -*-
22
from __future__ import unicode_literals
33

4+
import json
45
import time
56
import uuid
6-
import json
7-
import requests
8-
97
from os import environ
108
from os.path import isfile
119

10+
import requests
1211
from past.builtins import basestring
1312

14-
from yoti import YOTI_API_ENDPOINT
15-
from yoti.crypto import Crypto
13+
import yoti
1614
from yoti.activity_details import ActivityDetails
15+
from yoti.crypto import Crypto
1716
from yoti.protobuf.v1 import protobuf
1817

1918

@@ -67,7 +66,7 @@ def get_activity_details(self, encrypted_request_token):
6766

6867
def __make_request(self, encrypted_request_token):
6968
path = self.__get_request_path(encrypted_request_token)
70-
url = YOTI_API_ENDPOINT + path
69+
url = yoti.YOTI_API_ENDPOINT + path
7170
headers = self.__get_request_headers(path)
7271
response = requests.get(url=url, headers=headers)
7372

yoti/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import pytest
55

6-
from yoti.client import Client
6+
from yoti import Client
77
from yoti.crypto import Crypto
88

99
FIXTURES_DIR = join(dirname(abspath(__file__)), 'fixtures')

yoti/tests/test_client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# -*- coding: utf-8 -*-
22
from __future__ import unicode_literals
33

4-
import pytest
5-
64
from os import environ
5+
6+
import pytest
77
from past.builtins import basestring
88

99
try:
@@ -12,7 +12,8 @@
1212
import mock
1313

1414
from yoti import YOTI_API_ENDPOINT
15-
from yoti.client import Client, NO_KEY_FILE_SPECIFIED_ERROR
15+
from yoti import Client
16+
from yoti.client import NO_KEY_FILE_SPECIFIED_ERROR
1617
from yoti.activity_details import ActivityDetails
1718
from yoti.tests.conftest import YOTI_CLIENT_SDK_ID, PEM_FILE_PATH
1819
from yoti.tests.mocks import (

0 commit comments

Comments
 (0)