Skip to content

Commit b758cde

Browse files
committed
Add winkerberos as an alternative dependency for kerberos
Based on another PR: cloudera#504
1 parent d6582ad commit b758cde

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Optional:
3838

3939
* `kerberos>=1.3.0` for Kerberos over HTTP support. This also requires Kerberos libraries
4040
to be installed on your system - see [System Kerberos](#system-kerberos)
41+
* On Windows operating systems an alternative is 'winkerberos' which can be installed with pip
4142

4243
* `pandas` for conversion to `DataFrame` objects; but see the [Ibis project][ibis] instead
4344

impala/_thrift_api.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,14 @@ def get_custom_headers(cookie_header, has_auth_cookie):
442442
elif auth_mechanism == 'GSSAPI':
443443
# For GSSAPI over http we need to dynamically generate custom request headers.
444444
def get_custom_headers(cookie_header, has_auth_cookie):
445-
import kerberos
445+
# Try importing kerberos, then winkerberos as fallback. Report the original exception for kerberos.
446+
try:
447+
import kerberos
448+
except ImportError as original_ex:
449+
try:
450+
import winkerberos as kerberos
451+
except ImportError:
452+
raise original_ex
446453
custom_headers = {}
447454
if cookie_header:
448455
log.debug('add cookies to HTTP header')

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def readme():
4444
install_requires=['six', 'bitarray', 'thrift==0.16.0', 'thrift_sasl==0.4.3'],
4545
extras_require={
4646
"kerberos": ['kerberos>=1.3.0'],
47+
"winkerberos": ['winkerberos'],
4748
},
4849
keywords=('cloudera impala python hadoop sql hdfs mpp spark pydata '
4950
'pandas distributed db api pep 249 hive hiveserver2 hs2'),

0 commit comments

Comments
 (0)