Skip to content

Commit 6573cc7

Browse files
author
Bilal Al
committed
moved kerberose import to loaders
1 parent 325059a commit 6573cc7

File tree

5 files changed

+18
-4
lines changed

5 files changed

+18
-4
lines changed

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
'requests',
2424
'pyyaml',
2525
'docopt>=0.6.2',
26-
'requests-kerberos>=0.14.0'
2726
'enum34;python_version<"3.4"',
2827
'bloom-filter2>=2.0.0'
2928
]
@@ -47,7 +46,8 @@
4746
'redis': ['redis>=2.10.5'],
4847
'uwsgi': ['uwsgi>=2.0.0'],
4948
'cpphash': ['mmh3cffi==0.2.1'],
50-
'asyncio': ['aiohttp>=3.8.4', 'aiofiles>=23.1.0']
49+
'asyncio': ['aiohttp>=3.8.4', 'aiofiles>=23.1.0'],
50+
'kerberos': ['requests-kerberos>=0.14.0']
5151
},
5252
setup_requires=['pytest-runner', 'pluggy==1.0.0;python_version<"3.8"'],
5353
classifiers=[

splitio/api/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import abc
66
import logging
77
import json
8-
from requests_kerberos import HTTPKerberosAuth, OPTIONAL
8+
from splitio.optional.loaders import HTTPKerberosAuth, OPTIONAL
99

1010
from splitio.client.config import AuthenticateScheme
1111
from splitio.optional.loaders import aiohttp

splitio/optional/loaders.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,17 @@ def missing_asyncio_dependencies(*_, **__):
1414
asyncio = missing_asyncio_dependencies
1515
aiofiles = missing_asyncio_dependencies
1616

17+
try:
18+
from requests_kerberos import HTTPKerberosAuth, OPTIONAL
19+
except ImportError:
20+
def missing_auth_dependencies(*_, **__):
21+
"""Fail if missing dependencies are used."""
22+
raise NotImplementedError(
23+
'Missing kerberos auth dependency. '
24+
'Please use `pip install splitio_client[kerberos]` to install the sdk with kerberos auth support'
25+
)
26+
HTTPKerberosAuth = missing_auth_dependencies
27+
OPTIONAL = missing_auth_dependencies
28+
1729
async def _anext(it):
1830
return await it.__anext__()

splitio/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '10.0.1'
1+
__version__ = '10.1.0-rc1'

tests/api/test_httpclient.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ def test_authentication_scheme(self, mocker):
168168
get_mock.return_value = response_mock
169169
mocker.patch('splitio.api.client.requests.get', new=get_mock)
170170
httpclient = client.HttpClient(sdk_url='https://sdk.com', authentication_scheme=AuthenticateScheme.KERBEROS)
171+
httpclient.set_telemetry_data("metric", mocker.Mock())
171172
response = httpclient.get('sdk', '/test1', 'some_api_key', {'param1': 123}, {'h1': 'abc'})
172173
call = mocker.call(
173174
'https://sdk.com/test1',
@@ -178,6 +179,7 @@ def test_authentication_scheme(self, mocker):
178179
)
179180

180181
httpclient = client.HttpClient(sdk_url='https://sdk.com', authentication_scheme=AuthenticateScheme.KERBEROS, authentication_params=['bilal', 'split'])
182+
httpclient.set_telemetry_data("metric", mocker.Mock())
181183
response = httpclient.get('sdk', '/test1', 'some_api_key', {'param1': 123}, {'h1': 'abc'})
182184

183185
def test_telemetry(self, mocker):

0 commit comments

Comments
 (0)