Skip to content

Commit

Permalink
Add winkerberos as an alternative dependency for kerberos
Browse files Browse the repository at this point in the history
Based on another PR:
cloudera#504
  • Loading branch information
csringhofer committed Apr 15, 2024
1 parent d6582ad commit b758cde
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Optional:

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

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

Expand Down
9 changes: 8 additions & 1 deletion impala/_thrift_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,14 @@ def get_custom_headers(cookie_header, has_auth_cookie):
elif auth_mechanism == 'GSSAPI':
# For GSSAPI over http we need to dynamically generate custom request headers.
def get_custom_headers(cookie_header, has_auth_cookie):
import kerberos
# Try importing kerberos, then winkerberos as fallback. Report the original exception for kerberos.
try:
import kerberos
except ImportError as original_ex:
try:
import winkerberos as kerberos
except ImportError:
raise original_ex
custom_headers = {}
if cookie_header:
log.debug('add cookies to HTTP header')
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def readme():
install_requires=['six', 'bitarray', 'thrift==0.16.0', 'thrift_sasl==0.4.3'],
extras_require={
"kerberos": ['kerberos>=1.3.0'],
"winkerberos": ['winkerberos'],
},
keywords=('cloudera impala python hadoop sql hdfs mpp spark pydata '
'pandas distributed db api pep 249 hive hiveserver2 hs2'),
Expand Down

0 comments on commit b758cde

Please sign in to comment.