Skip to content

Commit 00024da

Browse files
authored
Merge pull request #5 from getyoti/X-SDK
[SDK-113]: Added X-SDK identifier to headers sent in HTTP requests
2 parents a536255 + 1caad24 commit 00024da

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# -*- coding: utf-8 -*-
2+
SDK_IDENTIFIER = "Python"

yoti_python_sdk/client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import requests
1111
from past.builtins import basestring
1212

13+
from config import SDK_IDENTIFIER
14+
1315
import yoti_python_sdk
1416
from yoti_python_sdk.activity_details import ActivityDetails
1517
from yoti_python_sdk.crypto import Crypto
@@ -93,6 +95,7 @@ def __get_request_headers(self, path):
9395
return {
9496
'X-Yoti-Auth-Key': self.__crypto.get_public_key(),
9597
'X-Yoti-Auth-Digest': self.__crypto.sign('GET&' + path),
98+
'X-SDK': SDK_IDENTIFIER,
9699
'Content-Type': 'application/json',
97100
'Accept': 'application/json'
98101
}

yoti_python_sdk/tests/test_client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
except ImportError:
1212
import mock
1313

14+
from config import SDK_IDENTIFIER
15+
1416
from yoti_python_sdk import YOTI_API_ENDPOINT
1517
from yoti_python_sdk import Client
1618
from yoti_python_sdk.client import NO_KEY_FILE_SPECIFIED_ERROR
@@ -36,7 +38,8 @@ def expected_headers(x_yoti_auth_key, x_yoti_auth_digest):
3638
'Content-Type': 'application/json',
3739
'Accept': 'application/json',
3840
'X-Yoti-Auth-Key': x_yoti_auth_key,
39-
'X-Yoti-Auth-Digest': x_yoti_auth_digest
41+
'X-Yoti-Auth-Digest': x_yoti_auth_digest,
42+
'X-SDK': SDK_IDENTIFIER
4043
}
4144

4245

0 commit comments

Comments
 (0)